0% found this document useful (0 votes)
11 views

Unit 1 Class 1

The document discusses the internal components of a computer system including the motherboard, processor, RAM, hard disk drive, graphics card, and solid state drive. It then covers storage structures and hierarchy, caching, direct memory access structure, and interrupt handling in computer systems.

Uploaded by

spartansheik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Unit 1 Class 1

The document discusses the internal components of a computer system including the motherboard, processor, RAM, hard disk drive, graphics card, and solid state drive. It then covers storage structures and hierarchy, caching, direct memory access structure, and interrupt handling in computer systems.

Uploaded by

spartansheik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 66

UNIT 1

INTRODUCTION
Computer System - Elements and
organization; Operating System Overview -
Objectives and Functions - Evolution of
Operating System; Operating System
Structures – Operating System Services - User
Operating System Interface - System Calls –
System Programs - Design and Implementation
- Structuring methods.
Internal Computer Hardware
Motherboard
• The motherboard connects all the components in the computer.
The Processor
• The processor is a computer chip that carries out
instructions given by computer programs and handles
all the day to day tasks that a PC has to do.
• They used to use up an entire circuit board, but
nowadays, microprocessors like this one handle
everything from just one chip.
RAM
• RAM is a type of temporary computer data storage.
• It deals with temporary data requests such as keeping windows
open on a desktop or just viewing a file.
• RAM can also be overloaded which is the situation when a
window freezes during shutdown or stops working.
Hard Disk Drive ( HDD )
• The Hard Disk drive is a type of permanent computer data storage.
• Data is retrieved by using a series of rapidly spinning magnetic disks
that store the data.
• The spindle physically writes the data to the magnetic disk and is a
very delicate piece of hardware that must be handled carefully.
• Unlike RAM, hard drives retain data even if the machine is powered
off or cut off unexpectedly because of a power cut.
• Data can be lost if the hard drive breaks or becomes corrupt.
Graphics Card
• The graphics card is a type of expansion card that
processes and produces outputs for displays.
• These are a crucial component that monitors rely on.
• They also handle output of video (such as S-Video) to
projectors.
• They also have their own fans as this type of card gets
hot quickly and needs instant cooling.
Solid State Drive ( SDD )
• Solid State Drives are drives that have no actual mechanical parts
and are a form of computer data storage.
• There construction resembles that of a giant memory card found
in digital cameras.
• These drives boot up faster than traditional hard disks, but they
have less storage than their magnetic disks counterparts.
• They are also less susceptible to shock than regular hard disks,
reducing damage to the drive itself.
Storage Structure
• Main memory – only large storage media that the CPU can
access directly
– 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
– The disk controller determines the logical interaction
between the device and the computer
• Solid-state disks – faster than hard disks, nonvolatile
– Various technologies
– Becoming more popular
Storage Hierarchy
• Storage systems organized in hierarchy
– Speed
– Cost
– Volatility
• Caching – copying information into faster
storage system; main memory can be viewed as
a cache for secondary storage
• Device Driver for each device controller to
manage I/O
– Provides uniform interface between controller and
kernel
Storage-Device Hierarchy
Caching
• Important principle, performed at many levels in a
computer (in hardware, operating system, software)
• Information in use copied from slower to faster
storage temporarily
• Faster storage (cache) checked first to determine if
information is there
– If it is, information used directly from the cache (fast)
– If not, data copied to cache and used there
• Cache smaller than storage being cached
– Cache management important design problem
– Cache size and replacement policy
Direct Memory Access Structure
• Used for high-speed I/O devices able to
transmit information at close to memory
speeds
• Device controller transfers blocks of data from
buffer storage directly to main memory
without CPU intervention
• Only one interrupt is generated per block,
rather than the one interrupt per byte
What is an Operating System?
Operating System
• An Operating System can be defined
as an interface between user and
hardware.
• It is responsible for the execution of
all the processes, Resource
Allocation, CPU management, File
Management and many other tasks.
• The purpose of an operating system
is to provide an environment in
which a user can execute programs
in convenient and efficient manner.
Computer System Structure
• Computer system can be divided into four
components:
– Hardware – provides basic computing resources
• CPU, memory, I/O devices
– Operating system
• Controls and coordinates use of hardware among various
applications and users
– Application programs – define the ways in which the
system resources are used to solve the computing
problems of the users
• Word processors, compilers, web browsers, database systems,
video games
– Users
• People, machines, other computers
• OS is a resource allocator
– Manages all resources
– Decides between conflicting requests for efficient
and fair resource use
• OS is a control program
– Controls execution of programs to prevent errors
and improper use of the computer
Operating systems from two viewpoints
• User View
PC - ease of use
Mainframe or a minicomputer - to maximize resource
utilization
Workstations and servers – compromise between
individual usability and resource utilization.
Handheld computers -performance per unit of
battery life
• System View
Resource allocator - CPU time, memory space,
file-storage space, I/O devices, and so on.
Control program - manages the execution of user
programs to prevent errors and improper use of the
computer.
• Operating system is the one program
running at all times on the
computer—usually called the kernel
a computer program that is the heart and
core of an Operating System.
Whenever a system starts, the Kernel is the
first program that is loaded after the boot
loader because the Kernel has to handle the
rest of the thing of the system for the
Operating System.
The Kernel remains in the memory until the
Operating System is shut-down.
There are two other types of programs:
Systems programs
associated with the operating system but are not
part of the kernel
Application programs
include all programs not associated with the
operation of the system.
What happen when a Computer
Startup???
• bootstrap program is loaded at power-up or
reboot
– Typically stored in ROM or EPROM, generally
known as firmware
– Initializes all aspects of system
– Loads operating system kernel and starts
execution
Computer System Organization
• Computer-system operation
– One or more CPUs, device controllers connect
through common bus providing access to shared
memory
– Concurrent execution of CPUs and devices
competing for memory cycles
• I/O devices and the CPU can execute
concurrently.
• Each device controller is in charge of a
particular device type.
• Each device controller has a local buffer.
• CPU moves data from/to main memory
to/from local buffers.
• I/O is from the device to local buffer of
controller.
• Device controller informs CPU that it has
finished its operation by causing an interrupt.
Interrupt Handling
• An interrupt is a necessary part of Computer
System Organisation as it is triggered by
hardware and software parts when they
need immediate attention.
• An interrupt can be generated by a device or
a program to inform the operating system to
halt its current activities and focus on
something else.
• The types of interrupts are better explained
using the following diagram −
• Hardware and software interrupts are two
types of interrupts.
• Hardware interrupts are triggered by
hardware peripherals while software
interrupts are triggered by software function
calls.
• Hardware interrupts are of further two types.
• Maskable interrupts can be ignored or
disabled by the CPU while this is not possible
for non maskable interrupts.
Common Functions of Interrupts
• Interrupt transfers control to the interrupt
service routine generally, through the
interrupt vector, which contains the addresses
of all the service routines
• Interrupt architecture must save the address
of the interrupted instruction
• A trap or exception is a software-generated
interrupt caused either by an error or a user
request
• An operating system is interrupt driven
Interrupt Handling
• The operating system preserves the state of
the CPU by storing registers and the program
counter
• Determines which type of interrupt has
occurred:
• polling
• vectored interrupt system
• Separate segments of code determine what
action should be taken for each type of
interrupt
Interrupt Timeline
• Synchronous I/O: After I/O starts, control returns
to user program only upon I/O completion
– Wait instruction idles the CPU until the next interrupt
– Wait loop (contention for memory access)
– At most one I/O request is outstanding at a time, no
simultaneous I/O processing
• Asynchronous I/O: After I/O starts, control
returns to user program without waiting for I/O
completion
– System call – request to the OS to allow user to wait
for I/O completion
– Device-status table contains entry for each I/O device
indicating its type, address, and state
– OS indexes into I/O device table to determine device
status and to modify table entry to include interrupt
Two I/O methods
IO structure
● To start an I/O operation;
○ The device driver loads the appropriate registers within the
device controller.
○ The device controller, in turn, examines the contents of
these registers to determine what action to take (such as
"read a character from the keyboard").
○ The controller starts the transfer of data from the device to
its local buffer.
○ Once the transfer of data is complete, the device controller
informs the device driver via an interrupt that it has finished
its operation.
○ The device driver then returns control to the OS, possibly
returning the data or a pointer to the data if the operation
was a read.
How a Modern Computer Works

A von Neumann architecture


Computer-System Architecture
• Most systems use a single general-purpose processor
– Most systems have special-purpose processors as well
• Multiprocessors systems growing in use and
importance
– Also known as parallel systems, tightly-coupled systems
– Advantages include:
1. Increased throughput
2. Economy of scale
3. Increased reliability – graceful degradation or fault tolerance
– Two types:
1. Asymmetric Multiprocessing – each processor is assigned a
specific task.
2. Symmetric Multiprocessing – each processor performs all tasks
Symmetric Multiprocessing Architecture
A Dual-Core Design
• Multi-chip and multicore
• Systems containing all chips
– Chassis containing multiple separate systems
Clustered Systems
• Like multiprocessor systems, but multiple
systems working together
– Usually sharing storage via a storage-area network
(SAN)
– Provides a high-availability service which survives
failures
• Asymmetric clustering has one machine in hot-standby
mode
• Symmetric clustering has multiple nodes running
applications, monitoring each other
– Some clusters are for high-performance computing
(HPC)
• Applications must be written to use parallelization
– Some have distributed lock manager (DLM) to avoid
conflicting operations in shared access environment
Clustered Systems
Evolution of Operating System
Evolution of Operating System
• Serial processing
• From the 1940s to the mid1950s, programmers
setup and controlled early computers by loading
programs using punch cards, magnetic tape

• Simple Batch Processing


• After Serial Processing, the mid1950s introduced
Simple Batch Processing, the first operating system.
• This technology improved the efficiency of
scheduling and setup time as an operator loaded
user jobs sequentially in batches accessed by
monitor software
Operating System Structure
• Multiprogramming (Batch system) 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
– provide an environment in which the various system
resources (for example, CPU, memory, and peripheral
devices) are utilized effectively
– but they do not provide for user interaction with the
computer system.
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 (program loaded into memory and executing)
• If several jobs are ready to be brought into memory, and if
there is not enough room for all of them, then the system must
choose among them 🢡 job scheduling
• 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
Memory Layout for Multiprogrammed System
Operating-System Operations
• Interrupt driven (hardware and software)
– Hardware interrupt by one of the devices
– Software interrupt (exception or trap):
• Software error (e.g., division by zero)
• Request for operating system service
• Other process problems include infinite loop, processes
modifying each other or the operating system
• An interrupt service routine is provided that is
responsible for dealing with the interrupt
Operating-System Operations (cont.)
• Dual-mode operation allows OS to protect itself and
other system components
– User mode and kernel mode (supervisor mode, system mode, or
privileged mode)
– Mode bit provided by hardware
• kernel (0) or user (1)
• 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
• Increasingly CPUs support multi-mode operations
– i.e. virtual machine manager (VMM) mode for guest
VMs
Operating-System Operations (cont.)
Transition from User to Kernel Mode
• Timer to prevent infinite loop / process hogging
resources
– Timer is set to interrupt the computer after some
time period
– Keep a counter that is decremented by the physical
clock.
– Operating system set the counter (privileged
instruction)
– When counter is zero it generates an interrupt
– Set up before scheduling process to regain control or
terminate program that exceeds allotted time
Process Management
• A process is a program in execution.
• It is a unit of work within the system.
• Program is a passive entity, process is an active entity.
• Process needs resources to accomplish its task
– CPU, memory, I/O, files
– Initialization data
• Process termination requires reclaim of any reusable resources
• Single-threaded process has one program counter specifying
location of next instruction to execute
– Process executes instructions sequentially, one at a time, until
completion
• Multi-threaded process has one program counter per thread
• Typically system has many processes, some user, some
operating system running concurrently on one or more CPUs
– Concurrency by multiplexing the CPUs among the processes /
threads
Process Management Activities
The operating system is responsible for the
following activities in connection with process
management:
• Creating and deleting both user and system
processes
• Suspending and resuming processes
• Providing mechanisms for process synchronization
• Providing mechanisms for process communication
• Providing mechanisms for deadlock handling
Memory Management
• To execute a program all (or part) of the instructions
must be in memory
• All (or part) of the data that is needed by the
program must be in memory.
• Memory management determines what is in
memory and when
– Optimizing CPU utilization and computer response to
users
• Memory management activities
– Keeping track of which parts of memory are currently
being used and by whom
– Deciding which processes (or parts thereof) and data to
move into and out of memory
– Allocating and deallocating memory space as needed
Storage Management
• OS provides uniform, logical view of information storage
– Abstracts physical properties to logical storage unit - file
– Each medium is controlled by device (i.e., disk drive, tape drive)
• Varying properties include access speed, capacity,
data-transfer rate, access method (sequential or random)
• File-System management
– Files usually organized into directories
– Access control on most systems to determine who can access
what
– OS activities include
• Creating and deleting files and directories
• Primitives to manipulate files and directories
• Mapping files onto secondary storage
• Backup files onto stable (non-volatile) storage media
Mass-Storage Management
• Usually disks used to store data that does not fit in main
memory or data that must be kept for a “long” period of
time
• Proper management is of central importance
• Entire speed of computer operation hinges on disk
subsystem and its algorithms
• OS activities
– Free-space management
– Storage allocation
– Disk scheduling
• Some storage need not be fast
– Tertiary storage includes optical storage, magnetic tape
– Still must be managed – by OS or applications
– Varies between WORM (write-once, read-many-times) and RW
(read-write)
Performance of Various Levels of Storage

Movement between levels of storage hierarchy can be


explicit or implicit
Migration of data “A” from Disk to Register

• Multitasking environments must be careful to use most


recent value, no matter where it is stored in the storage
hierarchy

• Multiprocessor environment must provide cache


coherency in hardware such that all CPUs have the most
recent value in their cache
• Distributed environment situation even more complex
– Several copies of a datum can exist
I/O Subsystem
• One purpose of OS is to hide peculiarities of
hardware devices from the user
• I/O subsystem responsible for
– Memory management of I/O including buffering
(storing data temporarily while it is being
transferred), caching (storing parts of data in faster
storage for performance), spooling (the overlapping
of output of one job with input of other jobs)
– General device-driver interface
– Drivers for specific hardware devices
Protection and Security
•Protection – any mechanism for controlling access of processes or
users to resources defined by the OS
•Security – defense of the system against internal and external
attacks
• Huge range, including denial-of-service, worms, viruses, identity
theft, theft of service
•Systems generally first distinguish among users, to determine who
can do what
• User identities (user IDs, security IDs) include name and
associated number, one per user
• User ID then associated with all files, processes of that user to
determine access control
• Group identifier (group ID) allows set of users to be defined and
controls managed, then also associated with each process, file
• Privilege escalation allows user to change to effective ID with
more rights
System call
• A system call is a way for programs to interact with the
operating system.
• A computer program makes a system call when it makes a
request to the operating system’s kernel.
• System call provides the services of the operating system
to the user programs via Application Program
Interface(API).
• It provides an interface between a process and operating
system to allow user-level processes to request services of
the operating system.
• System calls are the only entry points into the kernel
system.
• All programs needing resources must use system calls.
Types of System Calls
There are 5 different categories of system calls –
• Process control: end, abort, create, terminate,
allocate and free memory.
• File management: create, open, close, delete,
read file etc.
• Device management
• Information maintenance
• Communication
Windows Unix
CreateProcess() fork()
Process Control ExitProcess() exit()
WaitForSingleObject() wait()
CreateFile() open()
ReadFile() read()
File Manipulation
WriteFile() write()
CloseHandle() close()
SetConsoleMode() ioctl()
Device Manipulation ReadConsole() read()
WriteConsole() write()
GetCurrentProcessID() getpid()
Information Maintenance SetTimer() alarm()
Sleep() sleep()
CreatePipe() pipe()
Communication CreateFileMapping() shmget()
MapViewOfFile() mmap()
SetFileSecurity() chmod()
Protection InitlializeSecurityDescriptor() umask()
SetSecurityDescriptorGroup() chown()
System programs
• System programs are utilities program that helps the user and
may call further system calls.
• System program provides a convenient environment for
program development and execution.
• Some are simply user interfaces two system calls and other are
considerably more complex.
• They can be divided into these categories -
• File Management-
– These programs create, delete, copy, rename, print, dump, and
generally manipulate files and directories.
• Status Information-
– Some system programs simply ask information related to the system
like date / time/ size of disc / number of users.
• File Modification-
– Several text editors may be available to create and modify the content
of files stored on disk or other storage devices.
– There may also be a special commands to search contents of files or
perform transformation of text.

You might also like