Processor Management

Modern compuers can do several things at the same time. This is achieved by processor management. This involves wo major issues -
   • Ensuring that each process and application receives enough of the processor's time to function properly
   • Using as many processor cycles as possible for real work

The basic unit of software that the operating system deals with in scheduling the work done by the processor is either a process or a thread, depending on the operating system.
The application you see (word processor, spreadsheet or game) is, indeed, a process, but that application may cause several other processes to begin, for tasks like communications with other devices or other computers. There are also numerous processes that run without giving you direct evidence that they ever exist. For example, Windows XP and UNIX can have dozens of background processes running to handle the network, memory management, disk management, virus checks and so on.
A process, then, is software that performs some action and can be controlled -- by a user, by other applications or by the operating system.
It is processes, rather than applications, that the operating system controls and schedules for execution by the CPU. In a single-tasking system, the schedule is straightforward. The operating system allows the application to begin running, suspending the execution only long enough to deal with interrupts and user input.
Interrupts are special signals sent by hardware or software to the CPU. It's as if some part of the computer suddenly raised its hand to ask for the CPU's attention in a lively meeting. Sometimes the operating system will schedule the priority of processes so that interrupts are masked -- that is, the operating system will ignore the interrupts from some sources so that a particular job can be finished as quickly as possible. There are some interrupts (such as those from error conditions or problems with memory) that are so important that they can't be ignored. These non-maskable interrupts (NMIs) must be dealt with immediately, regardless of the other tasks at hand.
While interrupts add some complication to the execution of processes in a single-tasking system, the job of the operating system becomes much more complicated in a multi-tasking system. Now, the operating system must arrange the execution of applications so that you believe that there are several things happening at once. This is complicated because the CPU can only do one thing at a time. Today's multi-core processors and multi-processor machines can handle more work, but each processor core is still capable of managing one task at a time.
In order to give the appearance of lots of things happening at the same time, the operating system has to switch between different processes thousands of times a second. 
1. A process occupies a certain amount of RAM. It also makes use of registers, stacks and queues within the CPU and operating-system memory space.
2. When two processes are multi-tasking, the operating system allots a certain number of CPU execution cycles to one program.
3. After that number of cycles, the operating system makes copies of all the registers, stacks and queues used by the processes, and notes the point at which the process paused in its execution.
4. It then loads all the registers, stacks and queues used by the second process and allows it a certain number of CPU cycles.
5. When those are complete, it makes copies of all the registers, stacks and queues used by the second program, and loads the first program.

Operating System as a Resource Manager

The Operating system of a Computer works as an inerface between he user, and hardware devices. Applicaion software is designed to achieve specific tasks whereas the hardware helps in achieving the task. The compuer system provides all this with the use of available resources. The hard disk, primary memory and the processor can be though of as resources.
the Operating System provides an ordered and conrolled allocaion of the processor, memories and I/O devices among he various programs.
Take for example, a computer system with a printer and two applications programs running. If both programs wish to print a document at the same time, will those be printed by the printer or will there be a contention? Here, the operating system comes into play: it manages to queue the outputs to the printer. In short, this means that it is the ask of the operating system to manage a computer's resources. Some of the resources that the operating system manages are:
  1. Processor
  2. Memory
  3. Devices
  4. Information
To explain simply :-

  • It manages the hardware and software resources of the system. In a desktop computer, these resources include such things as the processor, memory, disk space and more (On a cell phone, they include the keypad, the screen, the address book, the phone dialer, the battery and the network connection).
  • It provides a stable, consistent way for applications to deal with the hardware without having to know all the details of the hardware.
Types of Operating Systems
There are generally four types, categorized based on the types of computers they control and the sort of applications they support. The categories are:
1. Real-time operating system (RTOS) - Real-time operating systems are used to control machinery, scientific instruments and industrial systems. An RTOS typically has very little user-interface capability, and no end-user utilities, since the system will be a "sealed box" when delivered for use. A very important part of an RTOS is managing the resources of the computer so that a particular operation executes in precisely the same amount of time, every time it occurs.
2. Single-user, single task - As the name implies, this operating system is designed to manage the computer so that one user can effectively do one thing at a time. The Palm OS for Palm handheld computers is a good example of a modern single-user, single-task operating system.
3. Single-user, multi-tasking - This is the type of operating system most people use on their desktop and laptop computers today. Microsoft's Windows and Apple's MacOS platforms are both examples of operating systems that will let a single user have several programs in operation at the same time.
4. Multi-user - A multi-user operating system allows many different users to take advantage of the computer's resources simultaneously. Unix, VMS and mainframe operating systems, such as MVS, are examples of multi-user operating systems.