Professional Documents
Culture Documents
To describe the services an operating system provides to users, processes, and other systems To discuss the various ways of structuring an operating system To explain how operating systems are installed and customized and how they boot
System Calls
Virtual Machines
Application Software
System Software
Hardware
operating-system services
Program execution
I/O Operations
Resource allocation
File System Manipulation
Accounting
Communications between processes/users Error Management
I/O Operations
One set of operating-system services provides functions that are helpful to the user:
User interface - Almost all operating systems have a user interface (UI)
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 error)
I/O operations - A running program may require I/O, which may involve a file or an I/O device. File-system manipulation- Programs need to read and write files and directories, create and delete them, search them, list file Information, permission management.
Communications Processes may exchange information, on the same computer or between computers over a network
Communications may be via shared memory or through message passing (packets moved by the OS)
May occur in the CPU and memory hardware, in I/O devices, in user program
For each type of error, OS should take the appropriate action to ensure correct and consistent computing Debugging facilities can greatly enhance the users and programmers abilities to efficiently use the system
10
Another set of OS functions exists for ensuring the efficient operation of the system itself via resource sharing
Resource allocation
Accounting
11
Resource allocation - When multiple users or multiple jobs running concurrently, resources must be allocated to each of them
Many types of resources - Some (such as CPU cycles, main memory, and file storage) may have special allocation code, others (such as I/O devices) may have general request and release code.
Accounting - To keep track of which users use how much and what kinds of computer resources
12
Protection and security - The owners of information stored in a multiuser or networked computer system may want to control use of that information, concurrent processes should not interfere with each other
13
Service
Auditing Communication Error Management Keep track of who does what
Notes
Communication between processes (local and remote) Detection and management of errors, traps and exceptions to create a consistent, stable and safe environment. Secondary storage management, such as file and directory I/O. Management of devices, such as DVD, Tape, Keyboard and Mouse. Loading, running and management of programs. Resource allocation and management. User access control and data protection. A combination of graphical user interface (GUI), command line interface and batch interface.
14
15
Sometimes implemented in kernel, sometimes by systems program Sometimes multiple flavors implemented shells Primarily fetches a command from user and executes it
16
User-friendly desktop
17
18
User processes must not be given open access to the kernel code Any user or application request that involves access to any system resource must be handled by the kernel code
Typically written in a high-level language (C or C++) Mostly accessed by programs via a high-level Application Program Interface (API) rather than direct system call use
19
20
21
The user program makes a call to a library function. Library routine puts appropriate parameters at a wellknown place. There are three general methods to pass parameters between a running and operating system i.e. registers, stack, or a table in memory.
Process
Library Call
Simplest: pass the parameters in registers Parameters stored in a block, or table, in memory, and address of block passed as a parameter in a register Parameters placed, or pushed, onto the stack by the program and popped by the stack by the operating system
System Call
Block and stack methods do not limit the number or length of parameters being passed
22
trap
Kernel Code
The trap instruction is executed to change mode from user to kernel Control goes to operating system.
Dispatch Table
Kernel indexes the table, which contains pointers to service routines for system calls. Service routine is executed and return parameter or error code placed at well-known places (usually a CPU register).
Service Code
23
Process
Library Call System Call trap Dispatch Table Kernel Code Service Code
24
C program invoking printf() library call, which calls write() system call
25
buffer, nbytes).
26
27
Protection
28
System programs are a collection of system utilities that provide a useful environment to the user and which typically ship with the operating systems. Examples of system programs include
File Management Status information File modification Programming language support Program loading and execution Communications
Application programs
29
File Management
Application programs
30
31
Internal structure of different Operating Systems can vary widely Start by defining goals and specifications Affected by choice of hardware, type of system User goals and System goals
User goals operating system should be convenient to use, easy to learn, reliable, safe, and fast
System goals operating system should be easy to design, implement, and maintain, as well as flexible, reliable, errorfree, and efficient
32
The separation of policy from mechanism is a very important principle, it allows maximum flexibility if policy decisions are to be changed later
33
34
A system as large and complex as a modern OS must be engineered carefully if it is to function properly and be modified easily. A common approach is to partition the task into small components rather than have one monolithic system. Each of these modules should be a well defined portion of the system, with carefully defined inputs, outputs and functions.
35
The monolithic systems can also be subtitled as a Big Mess. The structure is that there is no structure.
The OS is written as a collection of procedures, each of which can call any of the other ones whenever it needs to.
Each procedure in the system has a well-defined interface in terms of parameters and results, and each one is free to call any other one, if the later provides some useful computation that the former needs.
There is no information hiding; every procedure is visible to every other procedure. Even in monolithic systems, however, it is possible to have at least a little structure. The system calls provided by the OS are requested by putting the parameters in well-defined places, such as in registers or on the stack, and then executing a special trap instruction known as kernel calls
36
Not divided into modules Although MS-DOS has some structure, its interfaces and levels of functionality are not well separated
37
The operating system is divided into a number of layers (levels), each built on top of lower layers. The bottom layer (layer 0), is the hardware; the highest (layer N) is the user interface. With modularity, layers are selected such that each uses functions (operations) and services of only lower-level layers
38
39
Provides Modularity Each layer uses functions and services of only lower layers Simplifies debugging and system verification.
Careful definition of layers, because a layer can only use the layers below it; Less efficient approach; e.g. when a program executes an I/O operation, it executes a system call that is trapped to the I/O layer, which in turn call the memory mgmt layer, which in turn call the CPU scheduling layer which is then passed to h/w. At each layer parameters may be modified, data may need to be passed and so on.
40
UNIX limited by hardware functionality, the original UNIX operating system had limited structuring. The UNIX OS consists of two separable parts
Consists of everything below the system-call interface and above the physical hardware Provides the file system, CPU scheduling, memory management, and other operatingsystem functions; a large number of functions for one level
41
Easier to extend a microkernel Easier to port the operating system to new architectures More reliable (less code is running in kernel mode) More secure
Detriments:
42
Uses object-oriented approach Each core component is separate Each talks to the others over known interfaces
43
44
VM is a software abstraction of a computer that often executes as a user application on the top of the native operating system.
CPU scheduling can create the appearance that users have their own processor
45
a) Non-virtual machine
46
47
The virtual-machine concept provides complete protection of system resources since each virtual machine is isolated from all other virtual machines. This isolation, however, permits no direct sharing of resources. A virtual-machine system is a perfect vehicle for operatingsystems research and development. System development is done on the virtual machine, instead of on a physical machine and so does not disrupt normal system operation. The virtual machine concept is difficult to implement due to the effort required to provide an exact duplicate to the underlying machine
48
VMware is a popular commercial application that abstracts Intel 80x86 h/w into isolated Virtual Machines. VMware runs as an application on a host OS such as Windows or Linux and allows this host system to concurrently run several different guest operating systems as independent Virtual Machines. Consider a developer has designed an application and would like to test it on Linux, UNIX, Solaris and Windows NT. Available Options are:
Obtain four PCs each having above OS installed and then run the application. Obtain one PC and install and run application one after the other. Use Vmware.
49
50
51
52
E ND
OF
C HAPTER 2