Lecture 1
Topics:
Operating System Services
User Operating System Interface
System Calls
Types of System Calls
System Programs
Operating System Design and Implementation
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.
Operating System Services:
Operating systems provide an environment for execution of programs and
services to programs and users
One set of operating-system services provides functions that are helpful to
the user:
User interface; Program execution; I/O operations; File-system
manipulation; Communications; Error detection
Another set of OS functions exists for ensuring the efficient operation of
the system itself via resource sharing
Resource allocation; Accounting; Protection and security
User Operating System Interface
CLI or command interpreter allows direct command entry: Sometimes
implemented in kernel, sometimes by systems program. Sometimes
multiple flavors implemented – shells.
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), and Java API for the Java virtual machine (JVM)
The system call interface invokes the intended 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 obey API and understand what OS will do as a result call
Most details of OS interface hidden from programmer by API
Managed by run-time support library (set of functions built into libraries
included with compiler)
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 address of block
passed as a parameter in a register. 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
Types of System Calls
Process control
File management
Device management
Information maintenance
Communications
Protection
Kernel: The kernel is a computer program at the core of a computer's
operating system and generally has complete control over everything in
the system. The kernel is also responsible for preventing and mitigating
conflicts between different processes
Shell: Shell is an interface between the operating system and the user. The
primary responsibility of the shell is to collect the user's input and execute
the program on the operating system based on that input.
A thread of execution is the smallest sequence of programmed
instructions that can be managed independently by a scheduler, which is
typically a part of the operating system. In many cases, a thread is a
component of a process.
The multiple threads of a given process may be executed concurrently (via
multithreading capabilities), sharing resources such as memory, while
different processes do not share these resources.
In particular, the threads of a process share its executable code and the
values of its dynamically allocated variables and non-thread-local global
variables at any given time.
The implementation of threads and processes differs between operating
systems.
System Programs
System programs provide a convenient environment for program
development and execution. They can be divided into: File manipulation;
Status information sometimes stored in a File modification; Programming
language support; Program loading and execution; Communications;
Background services; Application programs
Most users’ view of the operation system is defined by system programs,
not the actual system calls
Operating System Design and Implementation
Design and Implementation of OS not “solvable”, but some approaches
have proven successful
Internal structure of different Operating Systems can vary widely
Start the design 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, 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
The separation of policy from mechanism is a very important principle, it
allows maximum flexibility if policy decisions are to be changed later
(example – timer)
Specifying and designing an OS is highly creative task of software
engineering