Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
11 views14 pages

Chapter 2 - Operating Systems

Chapter 2 outlines the essential services provided by operating systems, including user interfaces, program execution, I/O operations, and resource management. It discusses system calls as a programming interface for accessing OS services, the types of system calls, and the structure of operating systems, highlighting various design approaches such as layered and microkernel systems. Additionally, it covers operating system debugging, performance tuning, system generation, and the boot process.

Uploaded by

Omar Shehata
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views14 pages

Chapter 2 - Operating Systems

Chapter 2 outlines the essential services provided by operating systems, including user interfaces, program execution, I/O operations, and resource management. It discusses system calls as a programming interface for accessing OS services, the types of system calls, and the structure of operating systems, highlighting various design approaches such as layered and microkernel systems. Additionally, it covers operating system debugging, performance tuning, system generation, and the boot process.

Uploaded by

Omar Shehata
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Chapter 2

One set of operating-system services provides functions that are helpful to the
user:

User interface
Varies between Command-Line Interface (CLI) , Batch, Graphics User
Interface (GUI)
Program execution
The system must be able to load a program into memory and to run that
program, end execution, either normally or abnormally
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 on
different computers over a network.
Error detection
May occur in the CPU and memory hardware, in I/O devices, in user
program.

Another set of OS functions exists 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 (Authorization)
- involves ensuring that all access to system resources is controlled
- Security (Authentication)
- Secure the system from outsiders requires user authentication, extends to
defending external I/O devices from invalid access attempts

User Operating System Interface - CLI


CLI or command interpreter allows users to enter commands that performed by
OS

Sometimes implemented in kernel, sometimes by systems program


Maybe multiple flavors implemented (shells)

User Operating System Interface - GUI


Many systems now include both CLI and GUI interfaces

Microsoft Windows is GUI with CLI “command” shell


Apple Mac OS X is “Aqua” GUI interface with UNIX kernel underneath and
shells available
Unix and Linux have CLI with optional GUI interfaces (CDE, KDE, GNOME)

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 Programming
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)
Java API for the Java virtual machine (JVM)

APIs are preferred over system calls because

System calls differ from platform to platform. By using a stable API, it is


easier to migrate your software to different platforms.
The operating system may provide newer versions of a system call with
enhanced features. The API implementation will typically also be
upgraded to provide this support, so if you call the API, you'll get it.
An API helps to exchange data between various systems, devices and
applications while a system call allows a program to access services from
the kernel of the operating system.

System Call Implementation


Typically, a number associated with each system call

System-call interface maintains a table indexed according to these numbers


The system call interface invokes proposed system call in OS kernel and
returns status of the system call and any return values

The caller need know nothing about how the system call is implemented

Just needs to follow API and understand what OS will do as a result call
System Call Parameter Passing
Often, more information is required than simply identity of desired system call

Three general methods used to pass parameters to the OS

Simplest: pass the parameters in registers


Parameters stored in a block, or table, in memory, and block address passed
as a parameter in a register
This approach taken by Linux and Solaris
Parameters pushed, onto the stack by the program and popped off the stack
by the operating system

Solaris

Solaris OS is a Unix-like operating system that was originally developed by


Sun Microsystems and later acquired by Oracle Corporation

Solaris OS is designed to run on SPARC and x86-64 workstations and servers


from Oracle and other vendors It has many features and capabilities that make
it suitable for enterprise-grade clouds, such as software-defined networking,
built-in virtualization, enhanced security, and compliance
Types of System Calls
Process control
end, abort
load, execute
create process, terminate process
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

File management
create file, delete file
open, close file
read, write, reposition
get and set file attributes

Device management
request device, release device
read, write, reposition
get device attributes, set device attributes
logically attach or detach devices

Information maintenance
get time or date, set time or date
get system data, set system data
get and set process, file, or device attributes

Communications
create, delete communication connection
Message passing model send, receive messages to host name or process
name
Shared-memory model create and gain access to memory regions
transfer status information
attach and detach remote devices

Protection
Control access to resources
Get and set permissions
Allow and deny user access

System Programs
System programs provide a convenient environment for program development
and execution.

Can be divided into these categories:

File manipulation and File modification


Status information
Programming language support
Program loading and execution
Communications
Background services
Application programs

File management
Create, delete, copy, rename, print, dump, list, and generally manipulate files and
directories

File modification
Text editors to create and modify files
Special commands to search contents of files or perform transformations of
the text

Status information
Some ask the system for info - date, time, amount of available memory, disk
space, number of users
Others provide detailed performance, logging, and debugging information
Typically, these programs format and print the output to the terminal or other
output devices

Programming-language support
Compilers, assemblers, debuggers and interpreters sometimes provided

Program loading and execution


Absolute loaders, relocatable loaders, linkage editors, and overlay-loaders,
debugging systems for higher-level and machine language

Communications
Provide the mechanism for creating virtual connections among processes, users,
and computer systems

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

Application programs
Don’t pertain to system
Run by users
Not typically considered part of OS
Launched by command line, mouse click, finger poke

Operating System Design and Implementation


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, error-free, and efficient

Important principle to separate


Policy: What will be done?
Mechanism: How to do it?

Mechanisms determine how to do something, policies decide what will be done

Operating System Structure


Various ways to structure one as follows

Simple Structure
Layered Approach
Microkernel System Structure
Modules
Hybrid Systems

Simple Structure
MS-DOS written to provide the most functionality in the least space

Not divided into modules


Although MS-DOS has some structure, its interfaces and levels of
functionality are not well separated

Layered Approach
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.

Microkernel System Structure


Moves as much from the kernel into user space

Mach example of microkernel


Mac OS X kernel (Darwin) partly based on Mach

Communication takes place between user modules using message passing

Benefits

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

Performance overhead of user space to kernel space communication


Modules
Most modern operating systems implement 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


Hybrid Systems
Most modern operating systems actually not one pure model

Hybrid combines multiple approaches to address performance, security,


usability needs
Linux and Solaris kernels in kernel address space, so monolithic, plus
modular for dynamic loading of functionality
Windows mostly monolithic, plus microkernel for different subsystem
personalities
Apple Mac OS X hybrid, layered, Aqua UI plus Cocoa programming
environment

Mac OS X Structure
This is kernel consisting of Mach microkernel and BSD Unix parts, plus I/O kit
and dynamically loadable modules (called kernel extensions)

iOS
Apple mobile OS for iPhone, iPad

Structured on Mac OS X, added functionality


Does not run OS X applications natively
Also runs on different CPU architecture
Cocoa Touch Objective-C API for developing apps
Media services layer for graphics, audio, video
Core services provides cloud computing, databases
Core operating system, based on Mac OS X kernel

Android

Developed by Open Handset Alliance (mostly Google)

Based on Linux kernel but modified

Runtime environment includes core set of libraries and Dalvik virtual machine

Apps developed in Java plus Android API


Java class files compiled to Java bytecode then translated to executable
than runs in Dalvik VM

Libraries include frameworks for web browser (webkit), database (SQLite),


multimedia, smaller libc

Android Architecture

Operating-System Debugging
OSs generate log files containing error information

Failure of an application can generate core dump file capturing memory of the
process

Operating system failure can generate crash dump file containing kernel
memory

Beyond crashes, performance tuning can optimize system performance

Sometimes using trace listings of activities, recorded for analysis


Profiling is periodic sampling of instruction pointer to look for statistical trends

Performance Tuning
Improve performance by removing bottlenecks
OS must provide means of computing and displaying measures of system
behavior
For example, “top” program or Windows Task Manager

Operating System Generation


Operating systems are designed to run on any of a class of machines; the
system must be configured for each specific computer site

SYSGEN program obtains information concerning the specific configuration of


the hardware system

Used to build system-specific compiled kernel or system-tuned

System Boot
When power initialized on system, execution starts at a fixed memory location

Firmware ROM used to hold initial boot code

Operating system must be made available to hardware so hardware can start it

Small piece of code – bootstrap loader, stored in ROM or EEPROM locates


the kernel, loads it into memory, and starts it
Sometimes two-step process where boot block at fixed location loaded by
ROM code, which loads bootstrap loader from disk

Common bootstrap loader, GRUB, allows selection of kernel from multiple


disks, versions, kernel options

Kernel loads and system is then running

You might also like