Ch.1 Introduction
Ch.1 Introduction
Ch.1 Introduction
OPERATING SYSTEMS
Roshni M Balakrishnan
Department of Computer Science &
Engineering,
Amrita School of Engineering, Bengaluru
1
Topics
• Introduction to Operating Systems
• Characteristics – User/System view
• Functionalities
• Storage System
• Operating System Services
• Structure
• Introduction to System Calls
2
Introduction
• A program that acts as an intermediary between a user of a
computer and the computer hardware
3
4
What Operating Systems Do
User View
• Users(Single User) want convenience, ease of use and good performance
• Don’t care about resource utilization(how various hw and sw resources are
shared). This type of system is optimized for single user experience rather than
the requirements of multiple users
• But shared computer such as mainframe or minicomputer must keep all users
happy. Resource utilization is important. All resources are shared fairly among
the users. Example: z/OS
• Users of dedicate systems such as workstations have dedicated resources but
frequently use shared resources from servers (For example, network printers)
• Handheld computers such as smartphones and tablets, optimized for usability
and battery life
• Some computers have little or no user interface, such as embedded computers
in devices and automobiles.
5
6
Kernel
• Kernel is central component of an operating system that manages operations
of computer and hardware.
• It basically manages operations of memory and CPU time.
• It is core component of an operating system.
• Kernel acts as a bridge between applications and data processing performed
at hardware level using inter-process communication and system calls.
• Kernel loads first into memory when an operating system is loaded and
remains into memory until operating system is shut down again. It is
responsible for various tasks such as disk management, task management,
and memory management.
• Kernel has a process table that keeps track of all active processes
7
Functionalities
8
Storage Unit
Main memory (RAM) – only large storage media that the CPU can access directly (DRAM)
Random access
Typically volatile
Secondary storage – extension of main memory that provides large nonvolatile storage capacity
Hard disks – rigid metal or glass platters covered with magnetic recording material
Disk surface is logically divided into tracks, which are subdivided into sectors
9
Load instruction: It loads a byte or a word from RAM to CPU register
Store instruction: It moves data from CPU register to RAM
Instruction-execution cycle:
1) Fetches an instruction from memory and stores that instruction in
the instruction register.
2) The instruction is then decoded and may cause operands to be
fetched from memory and stored in some internal register.
3) After the instruction on the operands has been executed, the result
may be stored back in memory.
10
11
Hierarchy
Storage systems organized in hierarchy (The main differences among the
various storage system lie in)
– Speed
– Cost
– Volatility
Caching – copying information into faster storage system; main memory can be
viewed as a cache for secondary storage
12
13
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 - Almost all operating systems have a user interface (UI).
• Varies between Command-Line (CLI), Graphics User Interface
(GUI), touch-screen, 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.
Programs need to read and write files and directories, create and delete
them, search them, list file Information, permission management.
14
• 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
15
• 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 - CPU cycles, main memory, file storage, I/O
devices.
• Logging - 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
16
17
Structure
• Simple Structure
• Monolithic Structure
• Layered Approach Structure
• Micro-Kernel Structure
• Modular
• Virtual Machines
18
Simple Structure
19
Monolithic Structure
• Because layering is unnecessary and the
kernel alone is responsible for managing all
operations, it is easy to design and execute.
• Due to the fact that functions like memory
management, file management, process
scheduling, etc., are implemented in the
same address area, the monolithic kernel
runs rather quickly when compared to other
systems
20
Layered Structure
• The OS is separated into layers or levels in this kind
of arrangement. Layer 0 (the lowest layer) contains
the hardware, and layer 1 (the highest layer)
contains the user interface (layer N).
21
Microkernels
• Moves as much from the kernel into user
space
• Mach is an 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
22
Modules
23
Virtual Machines
• A virtual machine takes the layered approach to its logical
conclusion. It treats hardware and the operating system
kernel as though they were all hardware
• A virtual machine provides an interface identical to the
underlying bare hardware
• The operating system host creates the illusion that a process
has its own processor
24
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
Program Interface (API)
25
26
• Typically, a number is associated 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 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)
27
28
Types of System Calls
• Process control
• create process, terminate process
• end, abort
• load, execute
• 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
29
• 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
30
• 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
• send, receive messages if message passing model to host name
or process name
• From client to server
• Shared-memory model create and gain access to memory regions
• transfer status information
• attach and detach remote devices
31
• Protection
• Control access to resources
• Get and set permissions
• Allow and deny user access
32
Thank
you !!!!!
33