What is Multitasking concept in Unix and Linux
|
Posted On :
Jan-30-2012
| seen (300) times |
Article Word Count :
447
|
|
A quick look of multiprogramming and multitasking concept.
|
The more modern term multitasking includes the idea of multiprogramming but extend the concept to include the ability to run different parts of the same program also known as threads simultaneously. The basic idea is that most programs can be treated as a sequence of smaller elements called tasks. Sometimes these tasks must be executed and completed in order, one at a time. For example, task 2, say, may need the results from task 1 before it can proceed. On other occasions, some of all of the tasks in a program can be usefully tackled independently, without regard to the other tasks that are running. And, of course, you will encounter mixed situations where task 1, task 2, and task 3 can be run independently, but task 4 must await their completion.
Another element in the jigsaw is that many peripherals, such as tape and disk drives, can also operate independently.
An I/O task such as reading from a disk can be triggered by system call in program A and left to run independently while the operating system scans its table of suspended jobs and determines which of those that are "runnable" has the highest priority, say program B. The context of program A is then stored together with a flag indicating its wait status, waiting for a disk read. The previously saved context of program B is then restored and program B starts executing. But how will the suspended program A ever get restarted? Well, the I/O device needs to signal that its operation is complete, and this is done by a device interrupt.
Device interrupts are messages that system peripherals send to the CPU, telling it that they need its attention. For example, when you press a key on your keyboard, the keyboard stores the value of the keystroke and send an interrupt to the CPU, telling it that it has data waiting for it. As the name implies, an interrupt can occur at any time, and the kernel must take note of it even if no immediate restart of program A is possible. The kernel’s reaction to the interrupt in this case would be change the status of program A from “waiting for disk read” to "runnable". This restores program A as a candidate for execution, and eventually, depending on its relative priority, program A will regain its place in the sun.
Peeling off these deeply nested onion layers is a complex business; the key is to have an overall picture and lots of faith. Luckily, Unix offers you some simple commands that let you run as many programs as you wish and keep track of their progress.
|
|
Article Source :
http://www.articleseen.com/Article_What is Multitasking concept in Unix and Linux_141123.aspx
|
Author Resource :
Author is having 15+ years experience and providing DBA Services and Online Oracle Tutorials and Oracle DBA Forums.
|
Keywords :
Multitasking, multi tasking, multiprogramming, multi tasks, ,
Category :
Computers
:
Software
|
|
|