OS Structure
OS Structure
Operating System Concepts – 7th Edition, Jan 14, 2005 2.2 Silberschatz, Galvin and Gagne ©2005
Objectives
Operating System Concepts – 7th Edition, Jan 14, 2005 2.3 Silberschatz, Galvin and Gagne ©2005
OS Views
Operating System Concepts – 7th Edition, Jan 14, 2005 2.4 Silberschatz, Galvin and Gagne ©2005
Operating System Services
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)
Varies between Command-Line (CLI), Graphics User Interface
(GUI), Batch
» Batch : commands are entered into files, and those files are
executed. (Ex: updating an antivirus using a batch file)
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 - 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.
Operating System Concepts – 7th Edition, Jan 14, 2005 2.5 Silberschatz, Galvin and Gagne ©2005
Operating System Services (Cont.)
Another set of OS functions exists not for helping the user but rather for ensuring the
efficient operation of the system itself via resource sharing
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
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
Protection involves ensuring that all access to system resources is controlled
Security of the system from outsiders requires user authentication, extends to
defending external I/O devices from invalid access attempts
If a system is to be protected and secure, precautions must be instituted throughout
it.
Operating System Concepts – 7th Edition, Jan 14, 2005 2.6 Silberschatz, Galvin and Gagne ©2005
User Operating System Interface - CLI
Interacting with the OS takes two major directions : GUI and command line
interface (CLI).
CLI sometimes called shell, and it allows direct command entry
Sometimes implemented in kernel, sometimes it is considered and
implemented as a separate program (XP and UNIX did that)
Sometimes multiple flavors implemented – shells. The UNIX have many
shells which the user can choose from based upon personal preferences.
The main function of the CLI (shell) is to get and excute the next user
command such as delete, create, list, print, etc….
Primarily fetches a command from user and executes it
Operating System Concepts – 7th Edition, Jan 14, 2005 2.7 Silberschatz, Galvin and Gagne ©2005
User Operating System Interface - GUI
Operating System Concepts – 7th Edition, Jan 14, 2005 2.8 Silberschatz, Galvin and Gagne ©2005
System Calls
Programming interface to the services provided by the OS
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
Three most common APIs are Win32 API for Windows, POSIX API for POSIX-
based systems (including virtually all versions of UNIX, Linux, and Mac OS X),
and Java API for the Java virtual machine (JVM)
Why use APIs rather than system calls? (many many system calls needed for
copying a file to another file, API can reduce this complexity to the user)
More easier
Hide details of the OS from user.
(Note that the system-call names used throughout this text are generic)
Operating System Concepts – 7th Edition, Jan 14, 2005 2.9 Silberschatz, Galvin and Gagne ©2005
Example of System Calls
Operating System Concepts – 7th Edition, Jan 14, 2005 2.10 Silberschatz, Galvin and Gagne ©2005
System Call Implementation
Operating System Concepts – 7th Edition, Jan 14, 2005 2.11 Silberschatz, Galvin and Gagne ©2005
API – System Call – OS Relationship
Operating System Concepts – 7th Edition, Jan 14, 2005 2.12 Silberschatz, Galvin and Gagne ©2005
Standard C Library Example
C program invoking printf() library call, which calls write() system call
Operating System Concepts – 7th Edition, Jan 14, 2005 2.13 Silberschatz, Galvin and Gagne ©2005
System Call Parameter Passing
Often, more information is required than simply identity of desired system call
Exact type and amount of information vary according to OS and call
Three general methods used to pass parameters to the OS
Simplest: pass the parameters in registers
In some cases, may be more parameters than registers
Parameters stored in a block, or table, in memory, and the address of
block passed as a parameter in a register (see next slide).
This approach taken by Linux and Solaris
Parameters placed, or pushed, onto the stack by the program and popped
off the stack by the operating system
Block and stack methods do not limit the number or length of parameters
being passed while the first simplest method do.
Operating System Concepts – 7th Edition, Jan 14, 2005 2.14 Silberschatz, Galvin and Gagne ©2005
Parameter Passing via Table
Operating System Concepts – 7th Edition, Jan 14, 2005 2.15 Silberschatz, Galvin and Gagne ©2005
Types of System Calls
Operating System Concepts – 7th Edition, Jan 14, 2005 2.16 Silberschatz, Galvin and Gagne ©2005
MS-DOS execution
Operating System Concepts – 7th Edition, Jan 14, 2005 2.17 Silberschatz, Galvin and Gagne ©2005
OS structure
Modern OS are large and complex.
To reduce this complexity we take a common approach which partition the
whole to smaller parts.
The smaller parts should communicate, each of them have input, output, and
processing capabilities.
Those parts will form the kernel of the operating system.
The parts together form a structure.
Many structures are available:
Simple structure
Layered approach
Microkernel
Modules
Operating System Concepts – 7th Edition, Jan 14, 2005 2.18 Silberschatz, Galvin and Gagne ©2005
Simple Structure
Operating System Concepts – 7th Edition, Jan 14, 2005 2.19 Silberschatz, Galvin and Gagne ©2005
MS-DOS Layer Structure
Operating System Concepts – 7th Edition, Jan 14, 2005 2.20 Silberschatz, Galvin and Gagne ©2005
Layered Approach
Operating System Concepts – 7th Edition, Jan 14, 2005 2.21 Silberschatz, Galvin and Gagne ©2005
Layered Operating System`
Operating System Concepts – 7th Edition, Jan 14, 2005 2.22 Silberschatz, Galvin and Gagne ©2005
UNIX (it is a layerd approach)
Operating System Concepts – 7th Edition, Jan 14, 2005 2.23 Silberschatz, Galvin and Gagne ©2005
UNIX System Structure
Operating System Concepts – 7th Edition, Jan 14, 2005 2.24 Silberschatz, Galvin and Gagne ©2005
Microkernel System Structure
UNIX kernel is large and difficult to manage, so researchers at Carnegie Mellon
university create an OS called Mach. In this approach they remove all the non
essential components from the kernel (creating a Microkernel) and implement
them as a system and user-level programs.
Moves as much from the kernel into “user” space (user level programs).
Communication takes place between user modules using message passing
Benefits:
Easier to extend a microkernel (because the new services can be added to
the user level programs (user space) without any changes to the kernel).
Easier to port the operating system to new architectures (the kernel is small
and the needed changes for the kernel will be minimum changes).
More reliable (less code is running in kernel mode)
More secure (because most services are running in the user mode not in the
kernel mode)
Detriments:
Performance overhead of user space to kernel space communication.
Operating System Concepts – 7th Edition, Jan 14, 2005 2.25 Silberschatz, Galvin and Gagne ©2005
Mac OS X Structure
The
disadvantage
appears in this
area
(Performance
overhead of
user space to
kernel space
communication.)
Operating System Concepts – 7th Edition, Jan 14, 2005 2.26 Silberschatz, Galvin and Gagne ©2005
Modules
Operating System Concepts – 7th Edition, Jan 14, 2005 2.27 Silberschatz, Galvin and Gagne ©2005
Solaris Modular Approach
Operating System Concepts – 7th Edition, Jan 14, 2005 2.28 Silberschatz, Galvin and Gagne ©2005
Virtual Machines
Operating System Concepts – 7th Edition, Jan 14, 2005 2.29 Silberschatz, Galvin and Gagne ©2005
Virtual Machines (Cont.)
Operating System Concepts – 7th Edition, Jan 14, 2005 2.30 Silberschatz, Galvin and Gagne ©2005
End of Chapter 2