Excerpt from an in-depth understanding of operating system CHA 12
Concurrency is overlapping on logical control flows. Application-level concurrency is useful in the following situations:
1 access to slow I/O devices.
2 Interacting with people
3 Reduce latency by postponing work
4 Serving multiple network clients
5 concurrent operations on multicore machines
Applications that use application-level concurrency are called concurrent programs. The modern operating system provides 3 basic ways to construct concurrent programs:
1 Process: This method, each logical control flow is a process that is dispatched and maintained by the kernel. The process has its own virtual address space, and to communicate with other streams, the control flow must use the IPC (interprocess communication) mechanism. IPC mechanisms are: pipelines, shared memory, queues, semaphores
2 I/O multiplexing: In this concurrent programming, the application explicitly dispatches their own logical flow in the context of a process. The logical stream is transformed into a state machine, and after the data arrives at the file descriptor, the main program explicitly transitions from one state to another state. Because the program is a separate process, all streams share the same address space.
3 Threads: Threads are logical streams that run in a single process context and are dispatched by the kernel. Threads can be thought of as a mixture of other 2. is dispatched by the kernel like a process flow, and shares a virtual address space like an I/O multiplexed stream.
2016-06-27 Concurrent Programming