Previous | Next --- Slide 3 of 48
Back to Lecture Thumbnails
paluri

I noticed someone used the terminology, "fork a thread" in the Piazza posts - although I'm sure they used it inconsequentially, it actually got me thinking. Is there a type of workload that lends itself to using parallelism by actually dividing work among actual processes (e.g., on one machine, with say a dual core processor) instead of spawning threads, for example?

vrkrishn

@paluri

In general here are some advantages/disadvantages of using processes as opposed to threads.

Advantages: One thread can stomp on another thread's data because they share the same data space. No security between threads.

Disadvantages: Much quicker to create a thread than a process. Much quicker to switch between threads than to switch between processes. Threads share data easily

Now when we think about parallel workloads, we are describing workloads that are mostly independent. This takes away from the only real advantage to processes, assuring that one process does not mess up the data of a another process and cause some fatal termination. Therefore, it is the case that in most parallel programs, we want to use lightweight threads as our method of utilizing parallelism