Sunteți pe pagina 1din 2

Multiprogramming

The operating system can run MORE than one program. It divides the use of CPU among the programs on time sharing basis.

For example, let us say there are two programs waiting in the pool to be executed by the CPU. So, the OS picks the first program and executes. If the program has some I/O (which means input/output) operations involved, then it puts this program in the queue and picks the second program and executes, meanwhile the first program receiving its input.

Since the working of OS and CPU will be fast, it looks as if both the programs are executed simultaneously.

Multitasking

It is considered as the extension of multiprogramming. Here, the computer can perform more than one task.

For example, let us say you are printing a documet of 100 pages. While your computer is performing that, you still can do other jobs like typing a new document. So, more than one task is performed.

One of the main differences between multiprogramming and multitasking is, "In multiprogramming, a user cannot interact (everything is decided by OS, like picking the next program and sharing on time basis, etc...) where as in multitasking, a user can interact with the system (you can type a letter, while the other task of printing is going on)"

Multiprocessing

There will be more than one processor. So, a single program can be divided into pieces (like modules) and can be processed by the multi processors or sometimes, each processor can handle individual programs. (i.e If you have multiprocessing system, then it can either do multiprogramming as well as multitasking as well as multithreading). In Multiprocessing, each process will has its own system resources.

Multithreading

This type of programming helps when more than one client uses it. For example, let us take our DB. While I'm typing this post, there would be someone else, doing the same type of job. If DB is not having a multithread option, then not more than one person will be able to do the same job.

It will look like multiprocessing, that is a single program processed by more than one processor. But in multithreading, there is not a must that there should be several processors with individual resources, which actually increases the overhead of operating system to start/stop the resources everytime.

So here, a single program is divided into threads (which is a lightweight program). Then the part which is accessed by more than one client (for eg "Reply" and typing post in DB) alone will be executed as threads (making duplicates for each client), instead of running the whole program. Once when the purpose is solved, the thread will be deleted.

S-ar putea să vă placă și