Functions & Services of an OS

  1. Managing Resources: A device has a limited amount of resources that are critical for the execution of programs, including a limited amount of CPUs, limited memory size, limited secondary storage space, and a limited number of peripheral devices (like printers or speakers.) Since a running program might request more resources than available (e.g., the allocation of memory for a huge array,) or several programs that are running simultaneously may compete for resources, the OS must control the availability and allocation of resources among programs. The "CPU Scheduling" and "Memory Management" topics elaborate on this OS role.
    Examples:
    • When a program requests to allocate a piece of memory greater than the available, the OS will either deny the request, thereby terminating the program, or may use virtual memory (i.e., disk space instead of RAM space), if such a functionality is supported.
    • When the number of programs that are running concurrently is greater than the number of CPUs, the operating system will 'juggle' the programs. That is, each program will get a few milliseconds to run on an available CPU before being replaced by another program, a cycle that will repeat until the programs complete their execution.