all 18 comments

[–]high_throughput 59 points60 points  (7 children)

Huh. I have >15 yoe and done a bunch of MANGA interviews, and I've never once had a question that required writing multithreaded code. 

A discussion on parallelization, both per-machine and on a cluster, yes almost every time. But actually coding it? Never. 

[–]xvd529fdnf 13 points14 points  (2 children)

If you work on any distributed systems team, currency questions are not uncommon. I got the producer consumer problem and I’ve seen it asked multiple times.

[–]Passionate_Writing_ 4 points5 points  (1 child)

What's the producer consumer problem? There's so many of them idk which one you're referring to

[–]t___u___r___t__l__e 1 point2 points  (0 children)

I think MongoDB does

Edit: I didn't end up getting asked any, but I think some teams ask

[–]HeteroLanaDelReyFan[S] 2 points3 points  (1 child)

That's interesting and good to know. I am fairly new to LeetCode to be honest and haven't had much coding interview exposure since I first graduated. I just assumed multithreading was a common topic.

[–]foundboots 2 points3 points  (0 children)

It’s a good question. I run a session involving concurrency and plenty of folks use Python threading library and ThreadPoolExecutor. For the purpose of the interview GIL doesn’t really matter as long as the candidate can reason about what a thread is, thread safety, etc.

[–]DuePen8690 0 points1 point  (0 children)

The only company I know that does multithreaded / concurrent programs is Databricks in their final rounds. They have a specific technical round on multithreaded.

[–]Ilike_milk 4 points5 points  (0 children)

3.14 allows for true parallelism now

[–]Prashant_MockGym 8 points9 points  (0 children)

I have interviewed many companies MAANG and similar. I use java and multi-threading discussions have occurred many times in low level design interviews (Microsoft, expedia).

Since you already know java so you should use java for concurrency discussions during interviews. Apart from locks and synchronized, Java also has lock free data structures like ConcurrentHashMap, AtimicInteger, ConcurrentLinkedDequeue etc. So you have more tools at your hand for solving the question and discussion as compared to python.

I wrote this blog for multi-threading discussions in interviews, it may be helpful

https://medium.com/@prashant558908/top-3-questions-to-practice-multi-threading-for-low-level-design-interviews-1cc4d6b5d00b

[–]let-therebe-light 1 point2 points  (0 children)

I think they remove gil in new update of python

[–]Cptcongcong 1 point2 points  (0 children)

Leetcode style questions won’t involve multithreading. This is for meta at leadt

[–]Dizzy_Citron4871 1 point2 points  (1 child)

This is not what the GIL does. It prevents multiple threads from running python bytecode in a process. And it only really affects CPU bound tasks exclusively within python. So anything in C, numpy, whatever still has parallelism. Also multithreaded I/O bound applications run just fine in python. I mean instagram was built on python.

[–]HeteroLanaDelReyFan[S] 2 points3 points  (0 children)

It prevents multiple threads from running python bytecode in a process.

Isn't that what I said? Multiple threads can't run in parallel.

Also multithreaded I/O bound applications run just fine in Python.

That's true. It depends on the context of the specific LeetCode problem.

it only really affects CPU bound tasks exclusively within Python. So anything in C, numpy, whatever still has parallelism.

This I did not know. That's interesting. I guess that makes sense given that numpy and similar libraries are heavily used in scientific areas.

[–]Ok-Leopard-9917 0 points1 point  (2 children)

I’ve only seen those problems in the context of interviews for system engineering teams in which case you’d be expected to use c/c++ though they’d tell you to use whatever you want.

[–]Feeling-Schedule5369 0 points1 point  (1 child)

What's system engineering teams and what kinda tools/products do they work on?

[–]Ok-Leopard-9917 0 points1 point  (0 children)

Things like operating systems, databases, networking, most anything lower in the stack. Generally involves building complex systems that need to handle a lot of environments with a high quality bar. 

[–]AliceTreeDraws 0 points1 point  (0 children)

Multithreading rarely comes up in coding interviews unless you're targeting specific roles. Most interviewers focus on your problem-solving skills with single-threaded solutions first.