Operating Systems Structures and Processes Flashcards
• To describe the services an operating system provides to users, processes, and other systems. • To understand: • What is meant by Process in an operating systems sense • The composition of a process and how a process is scheduled in an operating system
Operating system services
- An operating system provides the environment within which programs
are executed. - It provides certain services to programs and to the users of those
programs. The specific services provided differ from one operating
system to another, but there are common classes
Types of Operating system services
User interface
Program execution
I/O operations
File-system manipulation
Communications
Error detection.
Resource allocation
Accounting
Protection and security
Operating system services User interface
- Almost all operating systems have a user interface (UI). Can have a command-
line interface (CLI), a batch interface, and/or a graphical user interface (GUI)
Operating system services Program execution
- The system must be able to load a program into memory and to run that
program. The program must be able to end its execution, either normally or
abnormally (indicating error)
Operating system services
Operating system service I/O operations
- A running program may require I/O, which may involve a file or an I/O device
(e.g. screen, DVD, etc.). Users usually cannot control I/O devices directly.
Therefore, the operating system must provide a means to do I/O.
Operating system services File-system manipulation
- Programs need to read and write files and directories. They also need to create
and delete them by name, search for a given file, and list file information.
Finally, some operating systems include permissions management to allow or
deny access to files or directories based on file ownership
Operating system services Communications
- There are many circumstances in which one process needs to exchange
information with another process. Such communication may occur between
processes that are executing on the same computer or between processes that
are executing on different computer systems tied together by a computer
network. Communications may be implemented via shared memory, in which
two or more processes read and write to a shared section of memory, or
message passing, in which packets of information in predefined formats are
moved between processes by the operating system.
Operating system services Error detection
- The operating system needs to detect and correct errors constantly. Errors may
occur in the CPU and memory hardware (such as a memory error or a power
failure), in I/O devices (such as a parity error on disk, a connection failure on a
network, or lack of paper in the printer), and in the user program (such as an
arithmetic overflow, an attempt to access an illegal memory location, or a too-
great use of CPU time). Correction might involve halting the system or
terminating a process
Operating system services Resource allocation
- When there are multiple users or multiple jobs running at the same time,
resources must be allocated to each of them. The operating system manages
many different types of resources. Some (such as CPU cycles, main memory, and
file storage) may have special allocation code, whereas others (such as I/O
devices) may have much more general request and release code
Operating system services Accounting
- We want to keep track of which users use how much and what kinds of
computer resources.
Operating system services: Protection and security.
- The owners of information stored in a multiuser or networked computer system
may want to control use of that information. When several separate processes
execute concurrently, it should not be possible for one process to interfere with
the others or with the operating system itself. Protection involves ensuring that
all access to system resources is controlled. Security involves securing the
system from outsiders, i.e. requiring users to authenticate themselves.
User Interface – command
interpreter
- CLI or command interpreter allows direct command entry.
- Sometimes implemented in kernel, sometimes by systems
program - Sometimes multiple types implemented as shells
- Primarily fetches a command from user and executes it
- Sometimes commands built-in, sometimes just names of
programs - Can use shell scripting to produce useful OS programs (Batch
Files)
User Interface – batch files
Collections of CLI commands run together to do
various tasks
User Interface – GUI
- Graphical User Interface (GUI)
- User-friendly desktop metaphor interface
- Usually mouse, keyboard, and monitor
- Icons represent files, programs, actions, etc.
- Various mouse buttons over objects in the interface cause various
actions (provide information, options, execute function, open
directory (known as a folder)
Program Execution and System
Calls
- 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) - Programming interface to the services provided by the OS
- Typically written in a high-level language
- 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)
What actually happens when a System
Program Makes a System Call?
- Typically the OS associates a number with each system call
- System-call interface maintains a table indexed according to these
numbers - The system call interface invokes the intended system call in the OS
kernel and returns status of the system call and any return values - The caller needs 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) - Parameters passing
- Use registers, table/memory block or the stack
Types of System Calls
- Process control
- File management
- Device management
- Information maintenance
- Communications
Types of System Calls Process control
- create process, terminate process, end, abort, load, execute, etc
Types of System Calls File management
- create file, delete file, open, close file, etc
Types of System Calls Device management
- request device, release device, read, write, etc
Types of System Calls Information maintenance
get time or date, set time or date, get system data, set system data,
etc
Types of System Calls Communications
create, delete communication connection, send & receive message
System programs
- Also known as system utilities. Basically, they provide a convenient
environment for program development and execution. - Some of them are simply user interfaces to system calls.
- Other are more complex, e.g. device driver