CSC 325 Operating Systems with an Emphasis on UNIX

Chapter 3: Operating System Structures

Operating System Structures

We want to look into the operating system from three view points:
  1. USERS: The services provided to users.
  2. PROGRAMMERS: The interface made available to programmers and how it is provided.
  3. operating system DESIGNERS: The methodologies for design.

Most operating systems support the following types of system components:

Process Management

A process is a program in execution. Examples of processes include batch jobs, system tasks - e.g. spooling a printer, UNIX commands like ls, ps. One may think of a process as a unit of work which consists of an executable program, the program's data and stack, its Program Counter, stack pointers, registers and all other information that is required to run the executable program.

The difference between a process and a program is that a program is a passive entity, such as the data stored onto the disk while a process is an active entity, where we know exactly what instruction to execute next. The process executes in a sequential fashion, one instruction at a time. Its possible that a program may have more than one process, but at any given time only one process executes.

Typically the information about each process, other than the contents of its address space, is stored in an operating system table called process table.

In Unix, as well other operating systems, a process called the shell (or command interpreter) reads command from the terminal. Suppose the user asks to compile a program. Then shell the creates a new process to take care of the compilation. When the compilation is finished this new process is killed (by a system call). Abstraction: Process created a child process.

Question: In a multiprogramming environment - how do we know which process belongs to which user! (Answer: pid-uid in Unix).

Main-Memory Management

Main memory is a large array of words which is the main direct accessible storage for the CPU. If the CPU wants data from the disk, it is first put into main memory and then the CPU accesses it. In a multiprogramming system, the operating system keeps several processes in main-memory. So we need some method of memory management.

I/O System Management

Much of the operating system kernel is concerned with I/O. The operating system provides a standard interface between user and system programs and devices. Device drives are the processes responsible for each device type. The operating system hides the peculiarities of specific hardware. In Unix, the bulk of specifics about the machine hardware is even hidden from bulk of the operating system itself, by providing an I/O subsystem which consists of a buffer-caching mechanism and general device driver interface drivers for specific hardware devices. Only the device driver needs to know the specifics of the machine hardware.

File Management

Since main memory is small and volatile, we need secondary memory. The operating system is responsible for disk management, and other functions like free-space management, storage allocation, and disk scheduling. The operating system abstracts the physical ideas of storage of information into a logical unit as defined by its creator, and this unit is called a file. The operating system maps files to a physical medium and accesses these files via storage devices.

Protection System

Protection refers to a mechanism for controlling access to resources. The protection mechanism must distinguish between authorized and unauthorized, specify the controls to be imposed, and provide a mechanism for enforcement.

Networking (Distributed Systems)

A distributed system is a collection of processors that do not share memory or a clock. They are connected by a communication network. The distributed system provides user access to various system resources. This is typically done by generalizing the network access as a file access, with the details about networking being contained in the network interfaces device driver. e.g. A world-wide example of a distributed system is the WWW, and an on-campus example of a distributed system is the Backbone or Lab-Network:

Command-Interpreter System

The program that reads and interprets control statements is in general called the command-line interpreter or the shell in UNIX. Its function is to get and execute the next command statement.

Operating-System Services

Additional operating-system functions exist not for helping the user, but rather for ensuring efficient system operation.

System Calls

System Programs

System Structure - Simple Approach

System Structure - Layered Approach

Virtual Machines

Advantages and Disadvantages of Virtual Machines

System Design Goals

Mechanisms and Policies

System Implementation