Week 02 Lecture Chapter 2
Week 02 Lecture Chapter 2
resources is controlled.
Security of th e system from outsiders requires user
authentication, extends to defending external I/O devices from
invalid access attempts.
A View of Operating System Services
Chapter 2: Operating-System Structures
mode bit 1
mode bit 0
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:
1. Simplest: pass the parameters in registers
In some cases, may be more parameters than registers.
2. Parameters stored in a block, or table, in memory, and address of
block passed as a parameter in a register.
This approach taken by Linux and Solaris.
3. 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.
Parameter Passing via Table
Chapter 2: Operating-System Structures
Process control
File management
Device management
Information maintenance
Communications
Protection
Types of System Calls
Process control:
create process, terminate process.
end, abort.
load, execute.
get process attributes, set process attributes.
wait for time.
wait event, signal event.
allocate and free memory.
Dump memory if error.
Debugger for determining bugs, single step execution.
Locks for managing access to shared data between processes.
Standard C Library Example
C program invoking printf() library call, which calls write() system call.
Types of System Calls
File management:
create, delete file.
open, close file.
read, write, reposition.
get and set file attributes.
Types of System Calls
Device management:
request, release device.
read, write, reposition.
get device attributes, set device attributes.
logically attach or detach devices.
Types of System Calls (Cont.)
Information maintenance:
get time or date, set time or date.
get system data, set system data.
get and set process, file, or device attributes.
Types of System Calls (Cont.)
Communications:
create, delete communication connection.
send, receive messages if message passing model to host
name or process name.
From client to server.
Shared-memory model create and gain access to memory
regions.
transfer status information.
attach and detach remote devices.
Types of System Calls (Cont.)
Protection
Control access to resources.
Get and set permissions.
Allow and deny user access.
Examples of Windows and Unix System Calls
Chapter 2: Operating-System Structures
Background Services
Launch at boot time.
Some for system startup, then terminate.
Some from system boot to shutdown.
Provide facilities like disk checking, process scheduling, error
logging, printing.
Run in user context not kernel context.
Known as services, subsystems, daemons.
System Programs (Cont.)
Along with the system programs, most operating systems are supplied
with programs that are useful in solving common problems or
performing common operations. Such Application programs, include
Web browsers, word processors and text formatters, spreadsheets,
database systems, compliers, plotting and games.
Don’t pertain to system.
Run by users.
Not typically considered part of OS.
Launched by command line, mouse click, finger poke.
Chapter 2: Operating-System Structures
3. Implementation:
Once an operating system is designed, it must be implemented.
Because operating systems are collections of many programs,
written by many people over a long period of time, it is difficult to
make general statements about how they are implemented.
An operating system can be written in more than one language:
Early OSes in assembly language. 1958- for scientific programming
3. Implementation (Cont.):
Actually usually a mix of languages
Lowest levels in assembly.
Main body in C.
Systems programs in C, C++, scripting languages like PERL,
Python, shell scripts.
The advantages of using a higher-level language, or at least a
systems implementation language, for implementing operating
systems are the same as those gained when the language is used for
application programs: the code can be written faster, is more
compact, and is easier to understand and debug.
Finally, an operating system is far easier to port if it is written in a
higher-level language.
Emulation can allow an OS to run on non-native hardware
effort to match/reproduction of the function or action of a different computer, software system
Chapter 2: Operating-System Structures
messages messages
microkernel
hardware
4. Modules
Perhaps the best current methodology for operating-system
design involves using loadable kernel modules.
Uses object-oriented approach.
Each core component is separate.
Each talks to the others over known interfaces.
Each is loadable as needed within the kernel.
Overall, similar to layers but with more flexible:
Linux, Solaris, etc.
Solaris Modular Approach
5. Hybrid Systems
Very few operating systems adopt a single, strictly defined
structure. Instead, they combine different structures, resulting in
hybrid systems that address performance, security, and usability
issues.
For Example: both Linux and Solaris are monolithic
The operating system is in a single address space provides very
efficient performance.
they are also modular, so that new functionality can be
dynamically added to the kernel.
Windows is largely monolithic as well (again primarily for
performance reasons), but it retains some behavior typical of
microkernel systems, including providing support for separate
subsystems (known as operating-system personalities) that run as
user-mode processes. Windows systems also provide support for
dynamically loadable kernel modules.
Mac OS X
kernel environment
BSD
Mach
Application Framework
surface media
Dalvik
manager framework
virtual machine
webkit libc
Chapter 2: Operating-System Structures
3. DTrace:
DTrace is a facility that dynamically adds probes to a running system, both
in user processes and in the kernel. These probes can be queried via the D
programming language to determine an astonishing amount about the
kernel, the system state, and process activities.
Chapter 2: Operating-System Structures