12

I am finding it difficult to clearly differentiate between Multiprogramming and Multitasking.

My primary source has been Wikipedia, but the WP article seems to be a little at odds with some less reputable sources (like my college professor).

As I read WP, multiprogramming is a rudimentary way of increasing CPU throughput, by context-switching when a process waits for I/O.

Multiprogramming doesn't give any guarantee that a program will run in a timely manner. Indeed, the very first program may very well run for hours without needing access to a peripheral.

Cooperative Time-sharing, synonymous with Cooperative Multitasking, is an improvement on multiprogramming (with which it is not synonymous). The CPU context-switches regularly to give the impression of simultaneous execution, but processes are still required to yield - and poorly designed programs can starve the rest of the system.

Preemptive Multitasking takes more aggressive control of scheduling, giving priority to some processes over others, etc.

  1. Is this overview correct? If not is that because WP is incorrect or because I read WP wrong?
  2. Why do some sources seem to conflate multiprogramming and multitasking?
Raphael
  • 73,212
  • 30
  • 182
  • 400
jsj
  • 680
  • 3
  • 8
  • 12

3 Answers3

10

They are more or less synonymous. Multiprogramming is more used when one CPU is involved, that is being switched from a process to the other, processes which are residing in memory simultaneously. Along came threads, and it wasn't switching between programs anymore...

Processors, particularly the intel line, had the mechanisms for true multitasking (timer interrupt, privileged instructions) since at least the 80286. The M68000 used in the very first Mac was a processor with full-fledged multitaking capacities. This isn't a recent development in architectures. Note that the very first time shared systems swapped the user's programs in and out, and thus weren't really multiprogramming in the sense of having several programs in memory at the same time.

The idea is to have several programs residing in memory simultaneously, so that when one yields the CPU (by finishing or by waiting) there are others ready to use the CPU, thus increasing CPU utilization (and as you can consider each CPU burst to be preparing for a use of I/O, increase overall usage). This gives better thoughput (important in batch systems).

Along came time sharing, several interactive users connected to the machine. Same idea, keep their programs around but switch among them fast enough so they have the ilusion of "having a computer to themselves". Requires a timer that interrupts the CPU to avoid monopolization.

On personal machines there was not much incentive to run several programs at a time, at least initially (one user in front of a severely limited machive didn't expect much). As machines grew, a way of working around this and allowing several programs at a time without changing the operating system much was "cooperative multitasking", in that every program is suposed to yield periodically to the operating system to select another one to run. As the program doing this is in full control, it can select to do this when nothing could get messed up by others. Needless to say, a program "forgetting" to fullfil its duty to yield gets an interesting boost in performance... early Mac systems worked this way, and for the above reasons this didn't last too long. On embedded systems with no or only rudimentary operating system, and a tightly controlled set of programs running, this is certainly an attactive option.

vonbrand
  • 14,204
  • 3
  • 42
  • 52
3

Difference between Multitasking and Multiprogramming? Multi tasking is a logical extension of multi programming. Classicaly in a multi programming environment, more than one user shares the cpu and the cpu rapidly switches from one user to another, providing a complete transparency from each other. In multitasking, the user is substituted by programs i.e more than one program shares the cpu and the cpu rapidly switches from one program to another. Actually a software residing on disk is a program. When it brought into RAM for execution is known as process or task and when it is inside the cpu and executing, is known as thread. So multiprograaming is basically for multi-users, and multitasking is for single user with multiple programs. Since most modern OS s supports both, so they are often spell interchangibly.

0

There are lot of differences between multitasking and multiprogramming.

Multitasking is executing more then one task at a single time. For example, you are listening to a song, printing a paper, and typing on MS-Word at the same time.

While multiprogramming, in this type of OS, we improve the CPU utilization using buffering and spooling. In sequential execution, the CPU sits idle after executing a program and loads the next program from the main memory. During i/o operations cpu also sits idel, the CPU also sits idle, but using a multiprogramming environment, the CPU switches to the next program and processes it. This is a technique used with the help of buffering and spooling.