Operating System: Management and Functions

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which of the following is the primary role of an operating system?

  • To manage computer resources and allocate them to programs and users. (correct)
  • To create and edit documents.
  • To provide internet access to the computer.
  • To design and develop software applications.

In the context of operating systems, what is a 'bootstrap' process?

  • A security protocol designed to prevent unauthorized access to system resources.
  • A program that initializes the operating system during startup. (correct)
  • A process that manages virtual memory allocation.
  • A method for prioritizing tasks within the CPU.

Which of the following is a key characteristic of 'Simple Batch Systems'?

  • Prioritization of processes based on user input.
  • Real-time interaction between the user and the computer.
  • No direct interaction between the user and the computer. (correct)
  • Direct user interaction with the computer.

Which condition is necessary for a deadlock to occur?

<p>All four conditions (mutual exclusion, hold and wait, no preemption, circular wait) must occur simultaneously. (C)</p> Signup and view all the answers

What is the purpose of 'Rollback' as a strategy for handling deadlocks?

<p>To restore the system to a previous safe state by undoing some of the processes. (D)</p> Signup and view all the answers

Which of the following describes a 'preemptive' scheduling algorithm?

<p>The operating system can interrupt a running process to favor another process. (D)</p> Signup and view all the answers

What is 'Turnaround Time' in the context of process scheduling?

<p>The total time from the submission of a process to its completion. (C)</p> Signup and view all the answers

What is the main goal of CPU scheduling algorithms?

<p>To keep the CPU as busy as possible and minimize response time. (A)</p> Signup and view all the answers

Which scheduling algorithm is optimal when all jobs/processes are available at the same time?

<p>Shortest Job First (SJF) (D)</p> Signup and view all the answers

What is a key problem with Non-preemptive Shortest Job First (SJF) scheduling when processes have different arrival times?

<p>It can cause longer waiting times for shorter processes due to the execution of a longer process that started earlier. (A)</p> Signup and view all the answers

In Round Robin scheduling, what is a 'quantum'?

<p>The amount of time a process is allowed to run before being preempted. (C)</p> Signup and view all the answers

What is a significant disadvantage of the First Come First Serve (FCFS) scheduling algorithm?

<p>It can lead to the convoy effect and poor resource utilization. (C)</p> Signup and view all the answers

In Priority Scheduling, what happens if multiple processes have the same priority?

<p>The processes are executed in FCFS manner. (A)</p> Signup and view all the answers

In a situation where incoming processes are short and there is no need for processes to execute in a specific order, which scheduling algorithm works best?

<p>First Come First Serve (FCFS) (B)</p> Signup and view all the answers

What is an 'interrupt' in the context of operating systems?

<p>A signal from hardware or software indicating an event that needs immediate attention. (D)</p> Signup and view all the answers

What distinguishes a 'maskable' hardware interrupt from a 'non-maskable' one?

<p>Maskable interrupts can be delayed, while non-maskable interrupts cannot. (D)</p> Signup and view all the answers

What is an 'Interrupt Service Routine' (ISR)?

<p>A routine that is executed when an interrupt occurs, to handle the interrupt. (D)</p> Signup and view all the answers

What is the purpose of 'context switching' during interrupt handling?

<p>To save the state of the current process and load the state of the interrupt handler. (D)</p> Signup and view all the answers

What is 'virtual memory'?

<p>A technique that allows a computer to use more memory than is physically available by using a portion of the hard drive. (C)</p> Signup and view all the answers

What is 'paging' in the context of memory management?

<p>A memory management technique in which the OS divides memory into fixed-size blocks called pages. (D)</p> Signup and view all the answers

What is 'thrashing' and how does it affect computer performance?

<p>Excessive swapping of pages between memory and disk, leading to significant performance degradation. (A)</p> Signup and view all the answers

What is the role of a 'device driver'?

<p>To provide a software interface for hardware devices, allowing the OS and other programs to interact with the device. (A)</p> Signup and view all the answers

Where is the 'Process Control Block' (PCB) stored?

<p>In the operating system kernel. (D)</p> Signup and view all the answers

What is 'polling' in the context of device management?

<p>A continuous checking of devices by a program or device to see their state. (D)</p> Signup and view all the answers

What is the main purpose of a 'buffer' in data transfer?

<p>To store data temporarily during transfer between devices or applications, often to cope with speed mismatches. (D)</p> Signup and view all the answers

What is 'spooling' primarily used for?

<p>Mediating between a computer application and a slow peripheral device, such as a printer. (B)</p> Signup and view all the answers

What is the purpose of 'file encryption'?

<p>To provide security by encoding a file so that only authorized parties can access it. (C)</p> Signup and view all the answers

What is the function of an 'access control list' (ACL) in a file system?

<p>To specify which users or system processes are granted access to objects, as well as the operations allowed on a given file. (A)</p> Signup and view all the answers

What does a command-line interface require of the user?

<p>Typing commands using a special language. (B)</p> Signup and view all the answers

What does the acronym 'WIMP' stand for in the context of a Graphical User Interface (GUI)?

<p>Windows, Icons, Menus, Pointers (D)</p> Signup and view all the answers

Flashcards

What is an Operating System?

An interface between the user and the machine; manages hardware and software resources.

OS Management Tasks

Managing tasks in order, coordinating memory, providing device interfaces, directing storage, and enabling software communication.

Functions of an OS

Booting, managing peripherals, providing a user interface, handling system resources, file management, and conducting error handling.

Bootstrap Process

A program that initializes the OS during startup; loads instructions when a computer is turned on.

Signup and view all the flashcards

Process State

The stage a process is in, such as new, ready, running, blocked, or terminated.

Signup and view all the flashcards

Process Control Block (PCB)

A data structure with process details: state, ID, CPU registers, scheduling info, memory management, accounting.

Signup and view all the flashcards

Deadlock

A set of blocked processes each holding a resource and waiting to acquire a resource held by another.

Signup and view all the flashcards

Conditions for Deadlock

Mutual exclusion, hold and wait, no preemption, and circular wait.

Signup and view all the flashcards

How to Avoid Deadlocks

Preventing processes from holding resources while waiting, or using resource preemption.

Signup and view all the flashcards

Handling Deadlock

Preemption, rollback to a safe state, or terminating processes.

Signup and view all the flashcards

Process Scheduling

Determining which process in the 'ready' state moves to the 'running' state.

Signup and view all the flashcards

Scheduling Algorithms

Algorithms to allocate resources to processes, considering priority, system resource utilization, and deadlines.

Signup and view all the flashcards

Throughput

Number of processes completed per unit time or the amount of work done in a unit of time.

Signup and view all the flashcards

Turnaround Time

Time to execute a process, from submission to completion.

Signup and view all the flashcards

Waiting Time

Sum of time waiting in the 'ready' queue.

Signup and view all the flashcards

Response Time

Time from request submission until the first response is produced.

Signup and view all the flashcards

Non Pre-emptive Scheduling

Give up CPU voluntarily.

Signup and view all the flashcards

Pre-emptive Scheduling

OS decides to favour another process, interrupting the current one.

Signup and view all the flashcards

First Come, First Serve (FCFS)

Process arriving first gets handled first.

Signup and view all the flashcards

Shortest Job First (SJF)

Process with shortest burst time or duration is processed first.

Signup and view all the flashcards

Round Robin (RR)

Each process gets a fixed time slice.

Signup and view all the flashcards

Interrupt

Signal from hardware/software needing immediate processing.

Signup and view all the flashcards

Hardware Interrupt

From external device where hardware generates a signal.

Signup and view all the flashcards

Software Interrupt

Caused by software instructions.

Signup and view all the flashcards

File encryption

Process of encoding a file for security.

Signup and view all the flashcards

Buffer

Memory storing transferred data.

Signup and view all the flashcards

Spooling

Sending data for processing to a store.

Signup and view all the flashcards

File management

How OS manages organized data.

Signup and view all the flashcards

Virtual Memory

OS is managing use of RAM and Secondary Storage .

Signup and view all the flashcards

Paging

divides memory into segments called pages and keeps them on secondary storage.

Signup and view all the flashcards

Study Notes

The Operating System

  • A computer system needs hardware and software resources to complete tasks
  • The required resources include input/output devices, memory, file storage, CPU etc.
  • Operating systems manage these resources and allocate them to specific programs and users when necessary
  • Operating systems manage processor, memory, files, and I/O devices internally
  • An operating system is the interface between the user and the machine

Operating System Management Tasks

  • Manages the processor by ordering tasks and pairing them into manageable sizes for the CPU
  • Manages memory by coordinating data flow to and from RAM, determining the need for virtual memory
  • Manages devices by providing an interface between connected devices
  • Manages storage by directing permanent data storage
  • Applications enable standard communication between software and computers

Functions of Operating System

  • Boots the computer
  • Performs basic computer tasks, such as managing peripheral devices like the mouse and keyboard
  • Provides a user interface, be it command line or GUI
  • Handles system resources like memory and CPU time allocation
  • Provides file management to manipulate, store, retrieve, and save data
  • Handles errors by taking preventive measures

History of Operating Systems

  • The evolution is dependent on the development of computer systems and their usage

Operating Systems - Late 1950s

  • Operating systems were improved and started supporting certain usages by the late 1950s:
  • Single-stream batch processing was possible
  • Common, standardized input/output routines could be used for device access
  • Program transition capabilities to reduce the overhead of starting a new job were implemented
  • Error recovery to clean up after abnormally terminated jobs was added
  • Job control languages allowed users to specify job definition and resource requirements

Operating Systems - In 1960s

  • 1961: The dawn of minicomputers
  • 1960s: Disks became mainstream
  • 1966: Minicomputers became cheaper, more powerful, and more useful
  • 1967-1968: The mouse was invented

Supported OS Features by 1970s

  • Multi-user and multitasking capabilities were introduced
  • Dynamic address translation hardware and virtual machines emerged
  • Modular architectures came into existence
  • Personal, interactive systems came into existence

Accomplishments after 1970

  • 1971: Intel announces the microprocessor
  • 1972: IBM introduces VM: the Virtual Machine Operating System
  • 1973: Ethernet
  • 1974: The Personal Computer Age begins; Gates and Allen write BASIC for the Altair
  • 1976: Apple II
  • August 12, 1981: IBM introduces the IBM PC
  • 1983: Microsoft begins work on MS-Windows
  • 1984: Apple Macintosh comes out
  • 1990: Microsoft Windows 3.0 comes out
  • 1991: GNU/Linux
  • 1992: The first Windows virus emerges
  • 1993: Windows NT
  • 2007: iOS
  • 2008: Android OS

Types of Operating Systems

  • Simple Batch System
  • Multiprogramming Batch System
  • Multiprocessor System
  • Desktop System
  • Distributed Operating System
  • Clustered System
  • Realtime Operating System
  • Handheld System

Simple Batch Systems

  • There is no direct interaction between the user and the computer in a simple batch system:
  • The user submits a job using cards or tape to a computer operator
  • The computer operator assembles a batch of jobs on an input device
  • Jobs are batched based on programming language and other requirements
  • A special program, the monitor, oversees each program's execution
  • The monitor resides in the main memory and is always available for execution

Advantages of Simple Batch Systems

  • No interaction between user and computer
  • No mechanism to prioritize processes

Multi-User Operating Systems

  • Allow many users to take advantage of the computer's resources simultaneously
  • The OS ensures balanced requirements for the users and separate resources for programs to prevent one user's problem from affecting others
  • Unix, VMS, and mainframe OS like MVS are examples of multi-user operating systems
  • Windows 2000 and Novell Netware can support many networked users but they aren't considered true multi-user operating systems

Functions of the Operating System

  • A bootstrap is the program that initializes the operating system (OS) during startup
  • Bootstrapping loads a set of instructions when a computer is turned on or booted
  • During startup, diagnostic tests like POST are performed to check configurations for devices
  • POST also implements routine testing for the connection of peripherals, hardware, and external memory devices
  • The bootloader or bootstrap program is then loaded to initialize the OS

Process Management

  • A process is a program in execution but is an 'active' entity as opposed to the program, which is considered a 'passive' entity
  • Attributes held by processes include hardware state, memory, CPU etc.

Process States

  • NEW: The process is being created
  • READY: The process is waiting to be assigned to a processor
  • RUNNING: Instructions are being executed
  • BLOCKED: The process is waiting for an event, like I/O completion or a signal
  • TERMINATED: The process has finished execution

Process Control Block

  • A Process Control Block exists for each process, containing all information about the process
  • It is a data structure containing:
  • Process State: Its current condition (running, waiting, etc.)
  • Process ID and the parent process ID
  • CPU registers and Program Counter: CPU registers and program counter hold the address of the next instruction to be executed
  • CPU Scheduling information: Priority and pointers to scheduling queues
  • Memory Management information: Page tables or segment tables
  • Accounting information: User and kernel CPU time consumed, account numbers, limits, etc.
  • I/O Status information: Devices allocated, open file tables, etc.

What is a Deadlock?

  • Deadlocks occur when a set of processes are blocked, each holding a resource and waiting to acquire a resource held by another process.

How to avoid deadlocks

  • Deadlocks can be avoided by evading at least one of the four conditions:
  • Mutual Exclusion
  • Hold and Wait
  • No Preemption
  • Circular Wait

Handling deadlock

  • Focuses on preventing deadlocks
  • The strategies that can be used to remove deadlock after occurrence include:
  • Preemption
  • Rollback
  • Kill one or more processes

Process Scheduling & Scheduling Algorithms

  • Determining which process in the "ready" state should move to the "running" state is known as Process Scheduling
  • Keeping the CPU busy and minimizing response time for programs is the primary goal
  • Achieved by applying rules for "swapping" processes in and out of the CPU
  • Scheduling falls into non-pre-emptive scheduling and pre-emptive scheduling
  • Non Pre-emptive Scheduling: current process release CPU voluntarily
  • Pre-emptive Scheduling: OS allocates CPU

Pre-emptive Scheduling

  • Shortest-Job-First (SJF),
  • round robin

Non-pre-emptive

  • First come first serve (FCFS)
  • Shortest-Job- First (SJF)

Scheduling Metrics

  • ThroughPut: the number of processes completed per unit of time
  • Turnaround Time: The interval from submission to completion
  • Waiting Time: the period spent waiting in the ready queue
  • Load Average: the average number of the processes residing in the ready queue waiting for their turn to get into the CPU
  • Response Time: the amount of time from request submission until the first response is produced

Aim of Scheduling Algorithms

  • Maximize CPU utilization
  • Ensure fair allocation of CPU
  • Maximize number of processes that complete their execution per time unit
  • Minimize time taken by a process to finish execution
  • Minimize time a process spends waiting in the ready queue
  • Minimize time it takes for a process to produce its first response
  • Ensure no task is starved of resources

Shortest Job First (SJF) Scheduling

  • Schedules processes based on burst time or duration, executing shortest first
  • This approach minimizes waiting time, typically for a batch system
  • Successfully executed if the burst time or execution duration of the processes is known in advance
  • It of 2 types:
    • Non-pre-emptive
    • Pre-emptive

Problem with Non-pre-emptive SJF

  • Can lead to the problem of starvation, where shorter processes have to wait unnecessarily

Pre-emptive Shortest Job First

  • Jobs are put into a ready queue when they arrive
  • When a process with a shorter burst time arrives, the existing one is preempted or removed from execution
  • The job with a shorter burst time will then execute first

Round Robin Scheduling

  • Uses a single queue of processes
  • When the system timer fires, the next process in the queue is switched to, and the preempted process returns to the queue.
  • A fixed amount of time is allotted to each process, and is called a quantum
  • After a process has executed for a given time period, it is then preempted and another process executes
  • Context switching saves states of preemptied processes

First Come First Serve (FCFS) Scheduling

  • The process that requests the CPU first is allocated the CPU first
  • This resembles a FIFO queue data structure
  • Easy to understand and implement programmatically
  • Real life example of this is buying tickets at ticket counter

Problems with FCFS Scheduling

  • It is a non-preemptive algorithm which means the process priority doesn't matter
  • Resources utilization in parallel is not possible, which leads to Convoy Effect, and hence poor resource(CPU, I/O etc) utilization

Priority Scheduling

  • A priority is assigned for each process, and processes with the highest priority are executed first
  • Processes with the same priority are executed in FCFS manner
  • Decisions can be made based on memory, time, or any other resource requirements

Comparison of Scheduling Algorithms

  • CPUs apply different scheduling algorithms to schedule processes

First Come First Serve (FCFS) - Advantages

  • The algorithm doesn't include any complex logic
  • It's pretty simple and easy to implement
  • Every process will eventually get a chance to run, preventing starvation

First Come First Serve (FCFS) - Disadvantages

  • There is no option for pre-emption of a process
  • If a process executes for a long time, other processes will have to wait longer

Shortest Job First (SJF) - Advantages

  • Processes are executed starting with the shortest jobs before running the longer ones
  • Higher throughput because more processes can be executed in a shorter period of time

Shortest Job First (SJF) - Disadvantages

  • The time taken by a process must be known by the CPU beforehand, which is not possible
  • Longer processes will have more waiting time, which can eventually cause starvation

Round Robin (RR) - Advantages

  • Each process is served by the CPU for a set amount of time, so each process is given the same priority
  • Starvation doesn't occur

Round Robin (RR) - Disadvantages

  • The throughput relies heavily on the length of the time quantum
  • If the time quantum is longer than needed, it will behave like FCFS
  • If the time quantum is shorter than needed, the CPU will switch too frequently between processes, reducing CPU efficiency

Priority based Scheduling - Advantages

  • The priority of a process can be selected on memory requirement, time requirement or user preference
  • A higher-end game will have better graphics

Priority based Scheduling - Disadvantages

  • A second scheduling algorithm is required to schedule the processes that have the same priority
  • If low priority processes keep waiting for higher priority processes, starvation will occur

Usage of Scheduling Algorithms in Different Situations

  • Every scheduling algorithm has a situation where it is the best choice

Situation 1

  • The incoming processes are short and there is no need for the processes to execute in a specific order
  • FCFS is the best in this case

Situation 2

  • The processes are a mix of long and short processes and the task will only be completed if all the processes are executed successfully in a set time
  • Round Robin Scheduling is the best in this case

Situation 3

  • The processes are a mix of user based and kernel based processes
  • Priority based scheduling is most efficient

Interrupts

  • A processor has to wait for a signal to begin processing but now only does it when new data is available
  • The signal from hardware or software should have the highest priority over all other instructions in the system
  • This processing signal is called Interrupt

What is an Interrupt?

  • It is a signal from hardware or software with the highest signal priority that a processor should process immediately

Types of Interrupts

  • There are 2 types:
  • Hardware Interrupts: If the signal for the processor is from an external device
    • Maskable Interrupt: Hardware interrupts which can be delayed when a much higher priority interrupt occurs to the processor
    • Non-Maskable Interrupt: Hardware interrupts that cannot be delayed
  • Software Interrupts: Interrupts that software instructions caused
    • Normal Interrupts: Software interrupts caused by software instructions
    • Exception: When a software instructions causes an unplanned interrupts

Interrupt Handling

  • The instruction cycle consists of fetch, decode, execute and read/write functions After every instruction, the processor will check for interrupts with the instruction register If there is an interrupt, it triggers which will stop the current instruction to save the configuration
  • Its configuration will load to the program counter of the interrupt from a location given by the interrupt vector table
  • The interrupt handler will load the instruction and its configuration from the saved register, and then complete This saving is called context switching
  • The interrupt handler is also called as Interrupt service routine (ISR).
  • Interrupts can occur at any time and are asynchronous. ISRs can call asynchronous interrupts
  • The interrupt service mechanism can call the ISR's from multiple sources
  • ISR's can handle both maskable and non-maskable interrupts, program can disable or enable an interrupt handler call
  • The nested interrupts are allowed in ISR for diversion to other ISR

Memory Management & Device Management

  • The process of controlling, coordinating, and assigning computer memory to various running programs to optimize overall system performance

Virtual Memory

  • Combines active RAM and inactive memory on Secondary Storage to form a large range of contiguous addresses
  • The primary benefits of virtual memory include freeing applications from having to manage a shared memory space, increased security due to memory isolation, and paging
  • The OS divides memory into pagefiles or swap files with a fixed number of addresses
  • Each page is stored on a disk so when the page is needed
  • The portion of the hard disk that acts as physical memory is called a page file
  • A page fault is a type of exception by the computer's hardware
  • Page faults usually mean that they need to allocate more memory

Thrashing

  • When the computer transfers pages it causes slowing down normal work
  • In computer science, thrashing occurs when a computer's virtual memory resources are overused
  • This inhibits the user from working

Device Management

  • The process of managing the implementation, operation and maintenance of physical devices

Device Drivers

  • A device driver is a computer program that operates or controls a particular type of device attached to a computer
  • It provides a software interface to hardware devices
  • They provide the interrupt handling required for any necessary asynchronous time-dependent hardware interface.

Devices, Interrupt Handling & the PCB

  • PCB is a data structure in the operating system kernel containing the information needed to manage the scheduling of a particular process
  • An interrupt is a signal sent to the processor because of a an event for immediate attention
  • When a device needs attention or has data, the operating system may pause the running process
  • After IRQ has been handled, OS then returns to the interrupted process to continue

Input/Output Control & Peripheral Control

  • Used as an input/output interface, IOC, or PIOC for Peripheral input/output controller
  • The input/output controller is a device that interfaces between an input or output device and the computer or hardware device
  • The input/output controller is located on the motherboard
  • The controller is a chip, card, or tool that interfaces with devices

Polling

  • It is continuously checking other programs or devices by a program or device
  • Polling is the opposite of interrupting

Buffer

  • It a memory area that stores data while they are transferred between two devices
  • Buffer usage occurs when the process has to
    • Enable faster transfer
    • Enable copy for application IO
  • Adapt IO between devices

Spooling

  • Sending data (intended for printing or processing on a peripheral device) to an intermediate store (e.g. buffer) is spooling
  • Spooling allows programs to "hand off" work to be done by the peripheral
  • Spooling is a combination of buffering and queueing

File Management

  • Manages how data is sorted into files, it helps the user to see files
  • The OS shows and helps store files, and fixes any errors
  • The OS alerts the user of corrupted files

File

  • Related documents that is on the computer
  • Example of files are disks and tapes
  • They may hold different records, such as images

Directories / Folders

  • Files are stored on the folder, and the folders are structured like a tree
  • Example file systems includes Linux, MS-DOS, OS/2, and Unix

Security of Files

  • Security on the computer to manage access
  • User ID: Each file is owned by a user
  • Passwords: To secure from unauthorized users

Lockwords

  • In security a lockword is a password associated with a file or data set, only set/changed by the owner
  • Not used to encrypt files it meant to be shared

Access Control List

  • Grants permissions access to another user Is a list showing which users are granted permission

File Encryption

  • Providing file security, only authenticated users can access the data
  • If a user tries to gain access without the permission

File Compression

  • Compress an archive to save space on the hard drive

Activity Logs

  • Records user actions. What a user did and when

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Operating System Basics
6 questions

Operating System Basics

AffectionateAzurite avatar
AffectionateAzurite
System Software Concepts
20 questions
Introduction to Operating Systems
8 questions
Operating Systems Overview
36 questions

Operating Systems Overview

LustrousEnjambment1955 avatar
LustrousEnjambment1955
Use Quizgecko on...
Browser
Browser