An operating system exists for many kinds of management: process, file, memory, event, output device, security, and application and system data.
The earliest computer systems allowed only batch processing, which means they executed only one program at a time. A school or company would have one computer (a mainframe), and the users would have to schedule time on it, the same way they would schedule the use of a conference room or an overhead projector.
Modern operating systems allow multitasking, which means several programs can be running at once. Originally this was seen as a way to avoid scheduling conflicts on a shared computer, but the capability has proven useful for personal computers as well. Multitasking has changed the way people use computers and the way they work in general. It's common for a user to have many programs open at once—an e-mail program, an instant messenger, a word processor, and a Web browser, for instance—and actively switch from one to the other as the work demands.
Even when the user is only running one program, though, the modern operating system depends on multitasking. That's because the operating system runs many background tasks, which are programs that receive no direct user interaction. An example of a background task is a print spooler. This program accepts print data to be printed from any application—like a word processor or e-mail program—and then slowly sends the data to the printer.
The print spooler is needed because printers can only accept a certain amount of data at a time. If a word processor were responsible for directly sending data to the printer, the word processor would be busy, and thus unusable, until the print job was finished. By handing the data off to a "middleman," the user can continue working immediately after starting the print job.
The operating system is responsible for keeping all the programs and background tasks executing, which is known as process management because the operating system deals with "processes" instead of "programs." A single program may have several instances running at the same time, and each instance is a separate process.
For example, it's common for users to have multiple Web browser windows open at once, and many nefarious Web sites will open a second window for you—usually containing an advertisement. Each of these windows is running the same program, but different processes. Each window represents another copy of the program in memory, and to the operating system it doesn't matter that they are copies of the same program.
Because most computers have only a single CPU, only one process can actually be running at any given time. The operating system achieves multitasking through a technique called time-slicing. Simply put, this means that the operating system runs a process for a short period of time (a fraction of a second), then sets it aside and runs another process for a while, and so on. A program that seems to be running continuously is actually being constantly started and stopped.
The operating system must decide how long and how often to run each process before moving on to the next one. A process can be in one of several states. A running process is currently executing on the CPU. A ready process is waiting for its turn to execute on the CPU. A blocked process is waiting for some event to happen to make it ready. For example, if the user has requested to save a file with the same name as an existing file, the program may put up an "Are you sure you want to overwrite the existing file?" message and wait for a response from the user. Because the process cannot continue until the user has made a decision, the operating system won't waste the CPU's time on it.
The length of a time slice must be determined carefully. Task switching, which is the term for pausing one process and starting another, takes time. The pipeline must begin anew when the CPU switches to a different process. Also, all the values in the CPU's registers must be stored in main memory so that when the process gets its next time slice, it can pick up right where it left off.
In general, then, the performance of the system is improved by having as few task switches as possible, which means having long time slices. The problem is, even though long slices keep the CPU doing as much useful work as possible, they lower the perceived performance of the system. That is, the user's experience with the system suffers, because there's often a greater delay between the user's action and the program's reaction on the monitor. Thus, the operating system must carefully manage the time slices to give the best balance between overall performance and user experience.
The operating system tries to schedule the use of the CPU to give more of its time to the processes that need it. This is not easy for the operating system to arrange because there's no way to predict which programs will be the busiest. Instead, the operating system monitors the use of the CPU and assumes that past use is a predictor of future use. The processes are in a queue, like a line at a ticket window.
When they get to the front, they use the CPU for a moment before they have to get back in line. If the process doesn't need all the CPU time it is offered, such as a background process, it is moved all the way to the back of the line, which means it takes a long time to get to the front again. A process still executing when its time slice runs out is assumed to be busy and is only sent back to a point in the middle of the line. This way, the busy processes get to the front of the CPU queue more often.
Our website is not responsible for the information contained by this article. Articleinput.com is a free articles resource thus practically any visitor can submit an article. However if you notice any copyrighted material, please contact us and we will remove the article(s) in discussion right away.
Note: This article was sent to us by: Ryan Welsh at 02122011
1. Visual computing and its research areas
All articles are property of their respective authors. Please read our Privacy Policy!
© 2009 ArticleInput.com.
Partners: Damenmode