0% found this document useful (0 votes)
11 views13 pages

Final 12345

Preparation for exam

Uploaded by

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

Final 12345

Preparation for exam

Uploaded by

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

Chapter 1

Components of computer system:


Hardware – provides basic computing resources (CPU, memory, I/O devices).
Operating system – controls and coordinates the use of the hardware among the
various application programs for the various users.
Applications programs – define the ways in which the system resources are used
to solve the computing problems of the users (compilers, database systems, video
games, business programs).
Users - people, machines, other computers.
The term software refers to the programs that execute on the computer. A
program is the step-by-step instructions that tell the computer how to do its
work. The purpose of software is to convert data into information The process of
writing (or coding) programs is called programming, and individuals who perform
this task are called programmers.

Two type of software:


System software works with end users, application software, and computer
hardware to handle the majority of technical details.
Application software is end user software that is used to accomplish a variety of
tasks.

System software of four types of programs:


Operating systems coordinate computer resources, provide an interface between
users and the computer, and run applications
Utilities perform specific tasks related to managing the computer resources
Device drivers allow particular input or output devices to communicate with the
rest of the computer system.
Language translators converts the programming instructions into a language the
computers understand.
Main part of OS
Kernel – it’s a computer program that constitutes the central core of a computer's
operating system. It has complete control over everything that occurs in the
system.
Device driver - is a program that controls a particular type of device that is
attached to computer. printers, displays, CD-ROM readers.
User Interface-means by which the user and a computer system interact.
System Utilities- Utility software is system software designed to help analyze,
configure, optimize or maintain a computer. Ex: Anti-virus, Disk cleaners, File
manage.
Function of OS:
Manages computer resources: OSs coordinate all the computer’s resources
including memory, processing, storage, and devices
They also monitor: System performance, Schedule tasks, Provide security and
Start-up the computer
Provides user interface: OSs allow users to interact with application programs
and computer hardware through a user interface: Character based Interface
Graphical User Interface (GUI)
Running applications: OSs load and run applications Multitasking: Foreground
and background programs
Common Operating system function: Memory Management, Process
Management, Storage Management, Device Management, Job Scheduling, User
Interface, Security, Start-up
Three basic categories of OS:
Embedded Operating Systems: Entire OS is stored within or embedded in the
device. Example: Smartphone.
Network Operating Systems: OS stored on network server which coordinates all
communication between the other computers. Example: Windows Server.
Systems Stand-alone Operating: Control a single desktop or notebook computer
It’s also called client operating system.
Chapter 2
Computer System: A computer system is one that is able to take a set of inputs,
process them and create a set of outputs. This is done by a combination of
hardware and software.
Operating System: An operating system is a program that acts as an interface
between the user and the computer hardware and controls the execution of all
kinds of programs.
Basic elements of computer Four main structural elements:
Processor: Controls the operation of the computer and performs it data
processing functions
Main memory: Stores data and programs, it’s a real memory or primary memory.
I/O modules: Move data between the computer and its external environment
System bus: Provides communication among processors, main memory, and I/O
modules.
User-visible registers can be read or written by machine instructions. Types of
registers:
1.General-Purpose Registers can store both data and addresses. Hold variables
and temporary results
2.Data register can hold numeric values such as integer and, in some
architectures, floating-point values, as well as characters, small bit arrays and
other data
3.Address registers hold addresses and are used by instructions that indirectly
access primary memory: Index register: values are added as an offset from some
address. Indexed addressing is a common mode of addressing that involves
adding an index to a base value to get the effective address. Segment pointer:
With segment addressing, memory is divided into segments which are variable
length blocks of words. Stack pointer: stores the address of the last program
request in a stack. A stack is a specialized buffer which stores data from the top
down
4.Condition codes register: Condition codes are bits set by the CPU hardware as
the result of operations.
Control and status registers Used by processor to control operating of the
processor. Types of registers:
Memory address register (MAR) Specifies the address in the memory for the next
read or write
Memory buffer register (MBR) Contains data to be written into memory or
receives data read from memory
I/O address register (I/O AR) Specifies particular I/O device
I/O buffer register (I/O BR) Used for exchange of data between an I/O module
and the processor
Program Counter (PC) Holds the memory address of the next instruction
Instruction Register (IR) Holds the instruction currently being executed
Special-Purpose Registers (SPRs) hold program state
How OS runs a program: The OS must load the address of the application’s
starting instruction into the PC. Example: Computer boots and begins running the
OS, OS code must get into memory somehow, Fetch/Decode/Execute OS
instructions.
Interrupt is an interruption in the normal execution of the program
Four Class of interrupt:
Program Interrupts: It occurs when some instruction within the program creates
a condition that leads to an interrupt
Timer Interrupts: This allows the operating system to perform certain functions
on a regular basis
I/O Interrupts: Generated by an I/O controller, to signal normal completion of an
operation or to signal a variety of error conditions.
Hardware failure Interrupts: Generated by a failure, such as power failure or
memory parity error.
Multiple Interrupts an interrupt occurs while another interrupt is being processed
receiving data from a communications line and printing results at the same time
Two Choices:
Disable Multiple Interrupts Disable upon entering an interrupt handler, enable
upon exiting, sequential execution of Interrupt
Allow Interrupts Allow an interrupt handler to be interrupted, Priority scheme
Memory Cache
Processor speed is much faster than memory speed
Memory cache contains a portion of main memory
Processor first checks the cache for required instruction
If the instruction is available in cache, it delivers to processor
Key elements of cache design:
Cache size: Small caches have a significant impact on performance
Block size: Unit of data exchanged between cache and main memory
Mapping function: When a new block of data is read into the cache, it determines
which cache location the block will occupy
Replacement algorithm: Determines which block to replace when a new block is
to be loaded in cache
Write policy: Write a block of cache back to main memory
Chapter 3
OS architecture: Kernel mode operations take place in something called ring 0 of
complex instruction set computing (CISC) processors. Most processors are CISC
processors used in computer system today. User mode operations take place in
the processor’s ring 3 (also known as non-privilege mode)
To simplify the way rings work in CISC processors
ring 3 processes can do only what ring 2 processes allow them to do.
ring 2 processes can do only what ring 1 processes allow them to do.
ring 1 processes can do only what ring 0 processes allow them to do.
Components of User mode:
System support process manage the system, such as the session manager,
the authentication subsystem, the service manager, and the logon process
Service Processes are those system or application processes that do run as
services
User Applications are the actual applications that users execute. These include
applications like Microsoft Excel and Adobe Photoshop
Components of Kernel mode:
1. Executive: Contains the base OS services, such as memory management,
process and thread management, security, I/O, and interposes communication.
2. Kernel: Controls execution of the processor(s). The Kernel manages thread
scheduling, process switching, exception and interrupt handling, and
multiprocessor synchronization.
3. Hardware abstraction layer (HAL): Maps between generic hardware commands
and responses and those unique to a specific platform
4. Device drivers: These include hardware device drivers that translate user I/O
function calls into specific hardware device I/O requests and software
components for implementing file systems, network protocols, and any other
system extensions that need to run in kernel mode.
Kernel VS user mode:
Kernel mode is generally reserved for the lowest-level, most trusted
functions of the operating system. Crashes in kernel mode are
catastrophic; they will halt the entire PC. In User mode, the executing
code has no ability to directly access hardware or reference memory.
Hardware layer − Hardware consists of all peripheral devices (RAM/ HDD/ CPU
etc.)
Kernel − Core component of Operating System (OS) that interacts directly with
hardware and provides low level services to upper layer components
Shell − An interface to kernel, hiding complexity of kernel's functions from users
Utilities − Utility programs that provide the user most of the functionalities of an
Oss
Chapter 4
Process: A program in execution. When we execute a program then it’s a process.
Process Management-After initiation of a program we demand Program should
be completed as early as possible that is process management
Reason of suspension: Swapping, timing, parent process request, interactive user
request.
OS maintains the following tables:
Memory tables- Used to keep track of both main and secondary memory,
Allocation of main memory to processes, Allocation of secondary memory to
processes
I/O tables- Used by OS to manage the I/O devices and channels of the computer
system, At any given time, an I/O device may be available or assigned to a
particular process
File tables- These tables provide information about existence of files, their
location on secondary memory, their current status, this information may be
maintained and used by a file management system
Process tables- OS must maintain Process tables to manage processes
Typical elements of process image:
User data: The modifiable part of the user space. Its include program data, a user
stack area.
User program: the program to be executed.
System stack: A stack is store to use parameters and calling address for procedure
and system calls.
process control block information can be grouped into three categories:
Process identification: Identifiers- that store with the process control block
Process state information:
 User visible register- it means the machine language that the processor
executes while in user mode.
 Stack pointers- its point to the top of the stack.
Process control information: data structuring, interprosses communication,
process privilege, memory management.
Typical function of a OS kernel: process management, i/o management, memory
management, support function.
A process switch may have occurred any time that OS has gained control from the
currently running process. Two types of system interrupts: Interrupt, Trap
Chapter 5
 Types of Scheduling:// Different between.
Non-Preemptive Scheduling Once the CPU has been allocated to a process, the
process keeps the CPU until it releases the CPU either by terminating or by
switching to the waiting state. (First-Come, First-Served (FCFS) Scheduling,
Shortest-Job-Next (SJN) Scheduling)
Preemptive Scheduling in this type of Scheduling, the tasks are usually assigned
with priorities. (Priority Scheduling, Shortest Remaining Time, Round Robin(RR)
Scheduling, Multiple-Level Queues Scheduling)
 Scheduling criteria:
PNO: Process Number
Arrival Time(AT): Time at which the process arrives in the ready queue.
Burst Time(BT): Time required by a process for CPU execution.
Completion Time(CT): Time at which process completes its execution.
Turn Around Time(TAT): Time Difference between completion time and arrival
time.
Turn Around Time = Completion Time - Arrival Time
Waiting Time(WT): Time Difference between turnaround time and burst time.
Waiting Time = Turn Around Time - Burst Time
Characteristics of FCFS:
Jobs are executed on first come, first serve basis.
It is a non-preemptive algorithm.
Easy to understand and implement.
Poor in performance as average wait time is high.
Shortest-job-next characteristics:
This is also known as shortest job first, or SJF
This is a non-preemptive scheduling algorithm.
Best approach to minimize waiting time.
SRT Characteristics:
Shortest remaining time (SRT) is the preemptive version of the SJN algorithm.
Impossible to implement in interactive systems where required CPU time is not
known.
It is often used in batch environments where short jobs need to give preference.
Round Robin(RR) Scheduling
Most popular CPU scheduling algorithm.
Criteria is Time Quantum
Mode is Preemptive
Chapter 6
deadlock occurs when a process or thread enters awaiting state because a
requested system resource is held by another waiting process. Example: System
has 2 tape drives.
Deadlock Characterization:
 Mutual exclusion: only one process at a time can use a resource.
 Hold and wait: a process holding at least one resource is waiting to acquire
additional resources held by other processes.
 No preemption: a resource can be released only voluntarily by the process
holding it, after that process has completed its task.
 Circular wait
Deadlock Prevention:
 Mutual Exclusion – Not required for sharable resources; must hold for non-
sharable sources.
 Hold and Wait – Must guarantee that whenever a process requests a
resource, it does not hold any other resources.
 No Preemption- Preempted resources are added to the list of resources for
which the process is waiting.
 Circular Wait – Impose a total ordering of all resource types, and require
that each process requests resources in an increasing order of
enumeration.
Deadlock Avoidance: Simplest and most useful model requires that each process
declare the maximum number of resources of each type that it may need, the
deadlock-avoidance algorithm dynamically examines the resource-allocation state
to ensure that there can never be a circular-wait condition.
Deadlock Detection: Allow system to enter deadlock state, Detection algorithm,
Recovery scheme.
Banker’s Algorithm: Multiple instances, each process must a priori claim
maximum use, when a process requests a resource it may have to wait.
Chapter 7
Major Responsibilities of OS in Memory Management:
 Memory Allocation- Place the process from Secondary memory to Main
memory.
 Address Translation- Logical address to Physical address.
Memory allocation:
Contiguous memory allocation: it’s a classical memory allocation model that
assigns a process consecutive memory blocks. Advantages: Quick access time,
Easy address translation. Disadvantages: External Fragmentation problem.
Non-Contiguous memory allocation: Its assigns the separate memory blocks at
the different location in memory space in nonconsecutive manner to a process
requesting for memory. Advantages: No External Fragmentation. Disadvantages:
Access very slow.
Contiguous memory allocation: 2 types
 Fixed Size Partitioning: First divide the memory in certain number of
partitions. Second size of each partition will be fixed and can’t be change.
 Variable Size Partitioning: First there will be no partition in the memory.
When a process come, according to the requirement we will allocate the
process one by one.
Swapping: A process can be swapped temporarily out of memory to a backing
store, and then brought back into memory for continued execution.
Backing store – fast disk large enough to accommodate copies of all memory
images for all users; must provide direct access to these memory images.
Roll out, roll in – swapping variant used for priority-based scheduling algorithms;
lower-priority process is swapped out so higher-priority process can be loaded
and executed.
Major part of swap time is transfer time; total transfer time is directly roportional
to the amount of memory swapped.
Fragmentation:
 Computer Memory: The part of a computer in which data or program
instructions can be stored for retrieval.
 Memory Fragmentation: Fragmentation occurs in a dynamic memory
allocation system when many of the free blocks are too small to satisfy any
request.
 External Fragmentation – total memory space exists to satisfy a request,
but it is not contiguous.
 Internal Fragmentation – allocated memory may be slightly larger than
requested memory. Some portion of memory is left unused as it cannot be
used by another process.
Logical address: It’s for user view, an address generated by CPU is referred to us
a logical address, the user program deals with logical address or these are
generated by user
Physical address: An address seen by memory unit that is the one loaded into the
memory address register of the memory is referred to as physical address, For
system view.
In (Memory-management unit) MMU scheme, the value in the relocation
register is added to every address generated by a user process at the time it is
sent to memory.
Paging(Non-Contiguous): Divide physical memory into fixed-sized blocks called
frames. Divide logical memory into blocks of same size called pages. Keep track of
all free frames.
Memory protection implemented by associating protection bit with each frame.
“valid” indicates that the associated page is in the process’ logical address space,
and is thus a legal page. “invalid” indicates that the page is not in the process’
logical address space.
Memory segmentation is the division of a computer's primary memory into
segments or sections. A program is a collection of segments. A segment is a logical
unit such as: main program, procedure, function, method, object.
Segmentation Architecture:
 Segment-table base register (STBR) points to the segment table’s location
in memory.
 Segment-table length register (STLR) indicates number of segments used
by a program.
Paging VS Segmentation:
 How paging and segmentation are similar: Both allows programs to run
despite insufficient memory, both are transferred into memory when
needed
 How paging and segment are different: pages are fixed size, made to fit
section of memory on the other hand segment are different size and
complete sections of programs.
Page replacement happens when a requested page is not in memory and a free
page cannot be used to satisfy the allocation, because the number of free pages is
lower than some threshold.
First-In-First-Out (FIFO) Replacement
Optimal Replacement
Least Recently Used (LRU) Replacement
Most Recently Used (MRU) Replacement

You might also like