Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Objectives
• 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
What is an operating System?
A program that acts as an intermediary between a user of a
computer and the computer hardware
Operating system goals:
Execute user programs and make solving user problems
easier
Make the computer system convenient to use
Use the computer hardware in an efficient manner
What Is An Operating System?
It
provides computer abstraction and
arbitration.
Main Function of An Operating System
• Abstraction
• Hides details of different hardware configurations
• Applications do not need to be tailored for each
possible device that might be present on a system
• Arbitration
• Manages access to shared hardware resources
• Enables multiple applications to share the same
hardware simultaneously
Abstraction
• Fact: Hardware devices manufactured by different manufacturer and
they have:
• Different low-level instructions to operate
• Different capabilities
• If a common interface didn’t exist..
• Variety of hardware might be limited
• Every application would have to be programmed to use all
required devices
• Example: 1990s – era computer games that required internal
programming for video and sound cards.
• Solution: Operating Systems provide a common interface for
hardware devices manufactured by different manufacturers.
Arbitration
• Fact: Hardware shared by multiple applications simultaneously.
• A computer user can run several applications at a time.
• It would be a big problem if the resources would not be allocated
according to application requests.
• Solution: OS ensures that all applications can access resources
• Divides CPU core time among different programs
• Manages access to RAM, I/O and disk
• Enforces system and security policies to isolate applications from each
other.
Abstraction or Arbitration?
• Supporting both Intel and AMD processors
• Switching between applications
• Separating memory allocated to different applications
• Enabling video conferencing software to use different camera
devices
• Accessing two different hard disks
• Sending and receiving messages over a network
Operating System Definition
No universally accepted definition.
Application
Operating System
Hardware
Layers of the Computer System
Application
Userspace
Hardware
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
• 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.
A View of Operating System Services
Operating System Services
• One set of operating-system services provides functions that are
helpful to the user (cont.):
• 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)
• Error detection – OS needs to be constantly aware of possible errors
• 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 user’s and programmer’s abilities to
efficiently use the system
Operating System Services
• 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 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. A
chain is only as strong as its weakest link.
Operating System Structure
Multiprogramming needed for efficiency
Single user cannot keep CPU and I/O devices busy at all times
Multiprogramming organizes jobs (code and data) so CPU always
has one to execute
A subset of total jobs in system is kept in memory
One job selected and run via job scheduling
When it has to wait (for I/O for example), OS switches to another
job
Operating System Structure
Timesharing (multitasking) is logical extension in which CPU switches
jobs so frequently that users can interact with each job while it is
running, creating interactive computing.
Response time should be < 1 second
Each user has at least one program executing in memory process
If several jobs ready to run at the same time CPU scheduling
If processes don’t fit in memory, swapping moves them in and out to
run
Virtual memory allows execution of processes not completely in
memory
Operating Systems Operations
Interrupt driven by hardware
Software error or request creates exception or trap
Division by zero, request for operating system service
Other process problems include infinite loop, processes
modifying each other or the operating system
Dual-mode operation allows OS to protect itself and other
system components
Operating Systems Operations
User mode and kernel mode
Mode bit provided by hardware
Provides ability to distinguish when system is running user
code or kernel code
Some instructions designated as privileged, only executable in
kernel mode
System call changes mode to kernel, return from call resets it
to user
Transition from User to Kernel Mode
Timer to prevent infinite loop / process hogging resources
Set interrupt after specific period
Operating system decrements counter
When counter zero generate an interrupt
Set up before scheduling process to regain control or
terminate program that exceeds allotted time
Transition from User to Kernel Mode
System Calls
• Programming interface to the services provided by the OS
• 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)
• File management
• Device management
• Information maintenance
• Communications
• Protection
Examples of Windows and Unix System Calls
MS-DOS execution
• With modularity, layers are selected such that each uses functions
(operations) and services of only lower-level layers
Traditional UNIX System Structure
UNIX
• UNIX – limited by hardware functionality, the original
UNIX operating system had limited structuring. The UNIX
OS consists of two separable parts
• Systems programs
• The kernel
• Consists of everything below the system-call interface and above the
physical hardware
• Provides the file system, CPU scheduling, memory management, and
other operating-system functions; a large number of functions for
one level
Layered Structure
• Technische Hogeschool Eindhoven(THE OS) – E.W Dijkstra,
Netherlands
• Structure
Layer Function
5 The operator
4 User programs
3 I/O management
2 Operator-process
communication
1 Memory management
0 Processor allocation and
multiprogramming
Layered Operating System
Microkernel System Structure
• Moves as much from the kernel into “user” space
• 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
Mac OS X Structure
Modules
• Most modern operating systems implement 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
• The operating system host creates the illusion that a process has its own
processor and (virtual memory).