Computer Architecture OS 2
Computer Architecture OS 2
Computer Architecture OS 2
Operating Systems
Software Of The Computer
If a user wants to enter and run an application program, he/she needs a System Software.
System Software is a collection of programs that are executed as needed to perform tasks
such as:
1. Receiving and interpreting user commands
2. Entering and editing application programs and storing then as files in secondary storage
devices.
3. Running standard application programs such as word processors, spread sheets, games
etc.
Operating system - is key system software component which helps the user to exploit the
below underlying hardware with the programs.
How do users and processes interact
with the operating system?
Users interact indirectly through a collection of system programs that make up the
operating system interface.
The interface could be: A GUI, with icons and windows, etc.
A command-line interface for running processes and scripts, browsing files in
directories, etc.
Or, back in the olden days, a non-interactive batch system that takes a collection of
jobs, which it proceeds to churn through (e.g. payroll calculations, market predictions,
etc.) Processes interact by making system calls into the operating system proper (i.e.
the kernel).
Though we will see that, for stability, such calls are not direct calls to kernel functions.
OS Architecture With Services
MONOLITHIC SYSTEMS ARC
The core software components of an operating system are collectively known as
the kernel. The kernel has unrestricted access to all of the resources on the system.
In early monolithic systems, each component of the operating system was
contained within the kernel, could communicate directly with any other component,
and had unrestricted system access. While this made the operating system very
efficient, it also meant that errors were more difficult to isolate, and there was a
high risk of damage due to erroneous or malicious code.
MONOLITHIC SYSTEMS ARC
OS services
A trap usually results in a switch to kernel mode, wherein the operating system
performs some action before returning control to the originating process.
Trapping to the Kernel
To get around the problem that no call can directly be made from user space to a specific
function in kernel space:
• Before issuing the trap instruction, an index is stored in a well known location (e.g. CPU
register, the stack, etc.).
• Then, once switched into kernel space, the index is used to look up the desired kernel
service function, which is then called.
Some function calls may take arguments, which may be passed as pointers to structures
via registers.
Trapping to the Kernel
OS Design
An OS is possibly the most complex system that a computer will run, and it not yet clear (nor
may it ever be) how to design an operating system to best meet the many and varied
requirements placed on it.
The internal structure of OSes can vary widely.
We can start by defining goals and specifications:
• Each is loadable as needed within the kernel, so you could download a new device
driver for your OS and load it at run-time, or perhaps when a device is plugged in.
Modular Kernel structure
Overall, similar to layered architecture but with more flexibility, since all require
drivers or kernel functionality need not be compiled into the kernel binary.
Note that the separation of the modules is still only logical, since all kernel code
(including dynamically loaded modules) runs in the same privileged address space (a
design now referred to as monolithic), so I could write a module that wipes out the
operating system no problem.
This leads to the benefits of micro-kernel architecture, which we will look at soon
Modular Kernel
Functions Of An Operating
System
Following are some of important functions of an operating System.
Memory Management
Processor Management
Device Management
File Management
Security
Control over system performance
Job accounting
Error detecting aids
Coordination between other software and users
Memory Management
The operating system manages the Primary Memory or Main Memory.
Main memory is made up of a large array of bytes or words where each byte or word
is assigned a certain address.
Main memory is a fast storage and it can be accessed directly by the CPU.
For a program to be executed, it should be first loaded in the main memory.
An Operating System performs the following activities for memory management:
It keeps tracks of primary memory, i.e., which bytes of memory are used by which
user program.
Memory Management
The memory addresses that have already been allocated and the memory addresses
of the memory that has not yet been used.
In multi programming, the OS decides the order in which process are granted access
to memory, and for how long.
It Allocates the memory to a process when the process requests it and deallocates
the memory when the process has terminated or is performing an I/O operation.
Processor Management
In a multi programming environment, the OS decides the order in which processes have
access to the processor, and how much processing time each process has.
This function of OS is called process scheduling.
An Operating System performs the following activities for processor management.
Keeps tracks of the status of processes.
The program which perform this task is known as traffic controller.
Allocates the CPU that is processor to a process. De-allocates processor when a process
is no more required.
Device Management
An OS manages device communication via their respective drivers.
It performs the following activities for device management.
Keeps tracks of all devices connected to system.
Designates a program responsible for every device known as the Input/Output
controller.
Decides which process gets access to a certain device and for how long.
Allocates devices in an effective and efficient way.
De-allocates devices when they are no longer required.
File Management
A file system is organized into directories for efficient or easy navigation and usage.
It keeps track of where information is stored, user access settings and status of
every file and more… These facilities are collectively known as the file system.