9
$\begingroup$

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?
$\endgroup$
  • 1
    $\begingroup$ "with some less reputable sources (like my college professor)" -- oh dear. I do hope (s)he is more reputable than Wikipedia, which has lots of half-baked content on CS. $\endgroup$ – Raphael Mar 26 '13 at 11:56
  • $\begingroup$ "multiprogramming" seems to be more a historical approach. modern multitasking is indeed related to IO blocking but its just one of the factors used to juggle processes. moreover almost all modern multitasking is preemptive with support from the CPU (which didnt always have that support years ago and well-behaved processes were supposed to call OS-based wait methods that supported the cooperation). $\endgroup$ – vzn Mar 26 '13 at 14:54
  • 2
    $\begingroup$ @Raphael, you can do the whole world a favor by baking them to perfection. $\endgroup$ – vonbrand Mar 26 '13 at 16:20
  • 1
    $\begingroup$ @vonbrand I tried, but unfortunately there are enough half-baked experts to conteract such attempts. $\endgroup$ – Raphael Mar 26 '13 at 17:20
  • $\begingroup$ @Raphael, and that crowd doesn't show up here also? $\endgroup$ – vonbrand Mar 26 '13 at 17:31
8
$\begingroup$

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 resiging 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.

$\endgroup$
  • $\begingroup$ the WP article seems to imply that multiprogramming lacks virtual memory, as opposed to multitasking (systems). Historically it may be true, but is the definition orthogonal? $\endgroup$ – didierc Mar 26 '13 at 17:32
  • 1
    $\begingroup$ We had a multiprogrammed IBM S/370 here in the '70s, and it definitely didn't have virtual memory (I seem to remember it had a disk used only for spooling). Virtual memory allows you to have even more programs in the limited RAM (as you are keeping only the "most used" parts at hand), even better utilization that way. So yes, I'd consider those totally independent; but in practice today you won't find one without the other. Except perhaps in your WiFi router or cellphone... $\endgroup$ – vonbrand Mar 26 '13 at 17:36
  • $\begingroup$ Ok. I thought so too, in fact. Embedded systems are indeed often lacking proper memory protection, I was aware of that. Nevertheless, with well behaved programs it shouldn't be a problem. That of course, depends on program vendors. $\endgroup$ – didierc Mar 26 '13 at 18:12
  • $\begingroup$ @didierc orthogonal? you mean mutually-exclusive right? $\endgroup$ – jsj Oct 16 '13 at 13:48
2
$\begingroup$

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.

$\endgroup$
0
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.