MultiThreading - sivakrsna/Java-Interview GitHub Wiki

Processes

  • Isolated, independently executing programs to which the operating system allocates resources such as memory, file handles, and security credentials.
  • If they needed to, processes could communicate with one another through a variety of coarse-grained communication mechanisms: sockets, signal handlers, shared memory, semaphores, and files.

Factors led to the development of operating systems that allowed multiple programs to execute simultaneously

Resource utilization Programs sometimes have to wait for external operations such as input or output, and while waiting can do no useful work. It is more efficient to use that wait time to let another program run.

Fairness Multiple users and programs may have equal claims on the machine’s resources. It is preferable to let them share the computer via finer-grained time slicing than to let one program run to completion and then start another.

Convenience It is often easier or more desirable to write several programs that each perform a single task and have them coordinate with each other as necessary than to write a single program that performs all the tasks.