Sunday, November 4, 2007

Operating Systems Services and Functions

Assignment Number 1

Submitted By

Uzair Sajid




Submitted To

Shaftab Ahmed

Computer Science Department

Bahria University


Operating System

An Operating System (OS) is the software that manages the sharing of the resources of a computer. An operating system processes system data and user input, and responds by allocating and managing tasks and internal system resources as a service to users and programs of the system. At the foundation of all system software, an operating system performs basic tasks such as controlling and allocating memory, prioritizing system requests, controlling input and output devices, facilitating networking and managing file systems. Major Operating Systems include Microsoft Windows, Sun Solaris, Mac OS, and the UNIX/Linux Family.

The Kernel

The kernel is the central component of most computer operating systems. Its responsibilities include managing the system's resources, and the communication between hardware and software components. As a basic component of an operating system, a kernel provides the lowest-level abstraction layer for the resources (especially memory, processors and I/O devices) that application software must control to perform its function. It typically makes these facilities available to application processes through inter-process communication mechanisms and system calls.

Functions and Services

The basic functions that an Operating System should provide include (but not limited to):

  • CPU and Process Management
  • Memory Management
  • I/O Management
  • Information And Storage Management
  • Network Management

Along with the fore mentioned functions, the operating system should also be able to provide the following basic services to the users:

  • User Interface
  • Program Execution
  • Security
  • Device Management
  • Resource Allocation and Accounting

The following paragraphs explain the above mentioned terms in a bit more detail.

CPU and Process Management

Every program running on a computer, be it a service or an application, is a process. As long as a von Neumann architecture is used to build computers, only one process per CPU can be run at a time. Older microcomputer Operating Systems such as MS-DOS did not attempt to bypass this limit, with the exception of interrupt processing, and only one process could be run under them. Mainframe operating systems have had multitasking capabilities since the early 1960s. Modern operating systems enable concurrent execution of many processes at once via multitasking even with one CPU. Process management is an operating system's way of dealing with running multiple processes. Since most computers contain one processor with one core, multitasking is done by simply switching processes quickly. Depending on the operating system, as more processes run, either each time slice will become smaller or there will be a longer delay before each process is given a chance to run. Process management involves computing and distributing CPU time as well as other resources. Most operating systems allow a process to be assigned a priority which affects its allocation of CPU time. Interactive operating systems also employ some level of feedback in which the task with which the user is working receives higher priority. Interrupt driven processes will normally run at a very high priority. In many systems there is a background process, such as the System Idle Process in Windows, which will run when no other process is waiting for the CPU.

Memory Management

Current computer architectures arrange the computer's memory in a hierarchical manner, starting from the fastest registers, CPU cache, random access memory and disk storage. An operating system's memory manager coordinates the use of these various types of memory by tracking which one is available, which is to be allocated or de-allocated and how to move data between them. This activity, usually referred to as virtual memory management, increases the amount of memory available for each process by making the disk storage seem like main memory. There is a speed penalty associated with using disks or other slower storage as memory.

Another important part of memory management is managing virtual addresses. If multiple processes are in memory at once, they must be prevented from interfering with each other's memory (unless there is an explicit request to utilize shared memory). This is achieved by having separate address spaces. Each process sees the whole virtual address space, typically from address 0 up to the maximum size of virtual memory, as uniquely assigned to it. The operating system maintains a page table that matches virtual addresses to physical addresses. These memory allocations are tracked so that when a process terminates, all memory used by that process can be made available for other processes.

The operating system can also write inactive memory pages to secondary storage. Under Microsoft Windows, this process is called paging.

I/O Management

Any Input/Output (I/O) devices present in the computer, such as keyboard, mouse, disk drives, printers, displays, etc require a significant amount of management. The Operating System allocates requests from applications to perform I/O to an appropriate device and provides convenient methods for using the device (typically abstracted to the point where the application does not need to know implementation details of the device). To perform useful functions, processes need access to the peripherals connected to the computer, which are controlled by the kernel through device drivers. For example, to show the user something on the screen, an application would make a request to the kernel, which would forward the request to its display driver, which is then responsible for actually plotting the character/pixel.

A kernel must maintain a list of available devices. This list may be known in advance (e.g. on an embedded system where the kernel will be rewritten if the available hardware changes), configured by the user (typical on older PCs and on systems that are not designed for personal use) or detected by the operating system at run time (normally called plug and play).

Information and Storage Management

All operating systems include support for a variety of file systems. Modern file systems comprise a hierarchy of directories. While the idea is conceptually similar across all general-purpose file systems, some differences in implementation exist. The file system is of particular interest. Obviously, programs need to read and write files and directories, create and delete them, search them, list file Information, permission management. File systems may provide journaling, which provides safe recovery in the event of a system crash. A journaled file system writes information twice: first to the journal, which is a log of file system operations, then to its proper place in the ordinary file system. In the event of a crash, the system can recover to a consistent state by replaying a portion of the journal. In contrast, non-journaled file systems typically need to be examined in their entirety by a utility such as fsck or chkdsk.

Network Management

Although not a core part of the operating system, the Network Manager has become essential in modern day computing. Most current operating systems are capable of using the TCP/IP networking protocols. This means that one system can appear on a network of the other and share resources such as files, printers, and scanners using either wired or wireless connections.

Many operating systems also support one or more vendor-specific legacy networking protocols as well, for example, SNA on IBM systems, DECnet on systems from Digital Equipment Corporation, and Microsoft-specific protocols on Windows. Specific protocols for specific tasks may also be supported such as NFS for file access.

User Interface

All operating systems need to provide an interface to communicate with the user. This could be a Command Line Interface or a Graphical User Interface.

A command line interface or CLI is a method of interacting with an operating system or software using a command line interpreter. This command line interpreter may be a text terminal, terminal emulator, or remote shell client. The concept of the CLI originated when teletype machines (TTY) were connected to computers in the 1950s, and offered results on demand, compared to 'batch' oriented mechanical punch card input technology. Dedicated text-based CRT terminals followed, with faster interaction and more information visible at one time, and then graphical terminals enriched the visual display of information. Currently personal computers encapsulate both functions in software.

A graphical user interface (GUI) is a type of user interface which allows people to interact with a computer and computer-controlled devices which employ graphical icons, visual indicators or special graphical elements called widgets, along with text, labels or text navigation to represent the information and actions available to a user. The actions are usually performed through direct manipulation of the graphical elements. Today, most modern operating systems contain GUIs. A few older operating systems tightly integrated the GUI to the kernel—for example, the original implementations of Microsoft Windows and Mac OS the Graphical subsystem was actually part of the operating system. More modern operating systems are modular, separating the graphics subsystem from the kernel (as is now done in Linux and Mac OS X) so that the graphics subsystem is not part of the OS at all.

Program Execution

The system must be able to load a program into memory and to run that program, end execution, either normally or abnormally (indicating an error). This involves locating the executable file on the disk or other secondary storage media and loading its content into the memory. These steps may further include processing by another parser or interpreter as in the case of .NET Platform, in which each program is compiled to MSIL (Microsoft Intermediate Language, now called CIL or Common Intermediate Language) and then parsed to assembly upon execution by the .NET JIT (Just In Time Compiler).


There are two generic levels of security, internal and external. Internal security can be thought of as protecting the computer's resources from the programs concurrently running on the system. Most operating systems set programs running natively on the computer's processor, so the problem arises of how to stop these programs doing the same task and having the same privileges as the operating system (which is after all just a program too). Processors used for general purpose operating systems generally have a hardware concept of privilege. Generally less privileged programs are automatically blocked from using certain hardware instructions, such as those to read or write from external devices like disks. Instead, they have to ask the privileged program (operating system kernel) to read or write. The operating system therefore gets the chance to check the program's identity and allow or refuse the request.

Typically an operating system offers (or hosts) various services to other network computers and users. These services are usually provided through ports or numbered access points beyond the operating systems network address. Services include offerings such as file sharing, print services, email, web sites, and file transfer protocols (FTP), most of which can have compromised security. These threats are categorized under external threats and are usually dealt with using add-on software like firewalls and antivirus programs.

Device Management

To perform useful functions, processes need access to the peripherals connected to the computer, which are controlled by the kernel through device drivers. For example, to show the user something on the screen, an application would make a request to the kernel, which would forward the request to its display driver, which is then responsible for actually plotting the character/pixel.

In a plug and play system, a device manager first performs a scan on different hardware buses, such as Peripheral Component Interconnect (PCI) or Universal Serial Bus (USB), to detect installed devices, then searches for the appropriate drivers.

As device management is a very OS-specific topic, these drivers are handled differently by each kind of kernel design, but in every case, the kernel has to provide the I/O to allow drivers to physically access their devices through some port or memory location. Very important decisions have to be made when designing the device management system, as in some designs accesses may involve context switches, making the operation very CPU-intensive and easily causing a significant performance overhead.

Resource Allocation and Accounting

When multiple users or multiple jobs running are concurrently on the operating system, resources must be allocated to each of them. Some (such as CPU cycles, main memory, and file storage) may have special allocation code and rules, while others (such as I/O devices) may have general request and release code. To keep track of which users use how much and what kinds of computer resources, the OS should also implement an Accounting scheme.