Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Chapter 3: Operating System

• 3.1 The History of Operating Systems

• 3.2 Operating System Architecture

• 3.3 Coordinating the Machine’s Activities

• 3.4 Handling Competition Among Processes

• 3.5 Security

Functions of Operating Systems:


1. Oversee operation of computer:
This involves monitoring the overall functioning of a computer system, ensuring hardware and software
components are working correctly, and troubleshooting any issues that may arise.

2. Store and retrieve files:


Managing data involves creating, organizing, storing, and retrieving files. This may include using file
systems, databases, or cloud storage solutions to efficiently store and access information.

3. Schedule programs for execution:


Planning and scheduling the execution of programs or tasks involve setting up a system to run specific
software applications or scripts at predetermined times or under certain conditions.

4. Coordinate the execution of programs:


Coordinating the execution of programs involves managing the flow of tasks, ensuring that different
programs or processes work together seamlessly. This may include prioritizing tasks, managing
dependencies, and optimizing resource usage.

Evolution of Shared Computing:


1. Batch Processing:
In batch processing, tasks are grouped together and processed without user interaction. Jobs are
collected, scheduled, and executed as a batch. This mode is efficient for handling large volumes of
similar tasks.
2. Interactive Processing:
Interactive processing involves communication between the computer system and users in real-time.
Users input commands, and the system responds immediately. This mode is suitable for scenarios where
user interaction and quick response times are crucial.

 Real-time Processing:
Real-time processing requires immediate processing and response to events as they occur. It is essential
in applications where timely and accurate results are critical, such as control systems, financial
transactions, or monitoring systems.

3. Time-sharing/Multitasking:
Time-sharing allows multiple users to interact with a computer system simultaneously. Each user gets a
small time slice or quantum to execute their tasks. Multitasking involves the concurrent execution of
multiple tasks, enhancing overall system efficiency.

 Multiprogramming:
Multiprogramming is a technique where multiple programs are loaded into the computer's memory at
the same time. The CPU switches between these programs, providing an illusion of concurrent execution
and improving resource utilization.

4. Multiprocessor Machines:
Multiprocessor machines have multiple processors (or cores) working together to execute tasks. This
architecture enhances processing power and allows for parallel execution of programs.

Figure 3.1 Batch processing:


Figure 3.2 Interactive processing:

Software:
Software is a program that enables a computer to perform a specific task.

Figure 3.3 Software classification:

Types of Software:
1. Application software:
It is a set of programs designed to carry out operations for specific applications.

For example:

Ms word, Excel, Accounts, Payroll etc

2. System software:
It is a set of programs that Provides infrastructure for application software.

For examples:

Interpreter, Compilers , Linker , Loader , Windows.


It Consists of operating system and utility software.

 Operating system :
It is a program that manage interactions between users , hardware and software and much more.

 Utility software:
It performs a very special task, usually related to managing system resources, e.g. utility compression,
defragmentation.

Operating System Components:


1. User Interface:
A User Interface (UI) is the point of interaction between a user and a computer system or
software application.
 Text based (Shell).
 GUI (graphic user interface) use graphical elements such as icons, buttons, windows, and
menus to enable user interaction.
 CLI (command line interface) relies on text-based commands input by the user. CLI is often
used by advanced users, system administrators, and developers for specific tasks.
 VUI (voice user interface) allows users to interact with a system using spoken commands or
queries. Voice assistants like Siri, Google Assistant, and Amazon Alexa are examples of VUIs.
2. Kernel:
Performs basic required functions.
 File manager.
 Memory manager.
 Scheduler and dispatcher.
 Device drivers.

Figure 3.4 The user interface act as an intermediary between users and the
operating system kernel:
File Manager:
The kernel is responsible for managing files and directories on the system. It provides a file
system interface, allowing applications to create, read, write, and delete files. The file manager
ensures proper organization, access control, and storage allocation for data.

1. Directory (or Folder):


A user-created bundle of files and other directories (subdirectories)

2. Directory Path: A sequence of directories within directories.


A directory is a virtual location in a file system that holds references to files or other directories. It
provides a way to organize and categorize information.

3. Purpose:
Directories serve the purpose of organizing files into a hierarchical structure, making it easier for users
to manage and locate specific files.

4. Hierarchy:
Directories are often organized in a hierarchical tree-like structure, with a top-level directory (root
directory) containing subdirectories, and these subdirectories may contain further subdirectories and
files.

Memory Manager:
Memory management is a critical aspect of the kernel's responsibilities. It allocates and
deallocates memory for processes, ensuring efficient use of available resources. The memory
manager also handles virtual memory, page swapping, and memory protection to prevent
unauthorized access.

1. Allocates space in main memory.


2. May create the illusion that the machine has more memory than it actually does (virtual
memory) by playing a “shell game” in which blocks of data (pages) are shifted back and forth
between main memory and mass storage.

Getting it Started (Bootstrapping):


• Boot loader: Program in ROM (example of firmware)

– Run by the CPU when power is turned on

– Transfers operating system from mass storage to main memory

– Executes jump to operating system

Figure 3.5 The booting process:


Processes:
1. Process:
A process is an instance of a computer program that is being executed by a computer's central
processing unit (CPU). It represents the execution of a set of instructions and includes various elements
such as code, data, and system resources.

2. Process State:
The process state refers to the current condition or status of a process during its execution. Common
process states include:

Running: The process is currently being executed by the CPU.

Ready: The process is ready to run but is waiting for the CPU to be assigned.

Blocked or Waiting: The process is waiting for an event (such as I/O completion) to proceed.

 Program Counter:
The program counter (PC) is a register in the CPU that keeps track of the memory address of the next
instruction to be executed. It is crucial for maintaining the sequence of program execution.

 General Purpose Registers:


General-purpose registers are storage locations within the CPU that are used for temporarily holding
data during program execution. They are not limited to a specific function and can be employed for
various purposes by the CPU or the program.

 Related Portion of Main Memory:


This refers to the section of the computer's main memory (RAM) that is allocated to a specific process. It
contains the program code, data, and other information required for the execution of the process.

Process Administration:
the kernel includes a scheduler that determines the order in which processes or threads are
executed on the CPU. It allocates CPU time to different tasks, making sure that each process
gets a fair share of the system resources. The dispatcher is responsible for the actual context
switching between processes.

1. Scheduler:
Adds new processes to the process table and removes completed processes from the process table

2. Dispatcher:
Controls the allocation of time slices to the processes in the process table

a. The end of a time slice is signaled by an interrupt.

Figure 3.6 Time-sharing between process A and process B

Device Drivers:
 Device drivers are essential components that allow the operating system to
communicate with hardware devices such as printers, disk drives, and network
interfaces. The kernel includes these device drivers to facilitate the interaction
between the hardware and higher-level software.

Handling Competition for Resources:


1. Semaphore:
A semaphore is a synchronization primitive used to control access to a shared resource in a concurrent
(multi-process or multi-threaded) system. It acts as a control flag or a signaling mechanism. Semaphores
can be used to manage access to resources and avoid conflicts between processes or threads.

2. Critical Region:
A critical region refers to a specific section of code or a group of instructions that must be executed by
only one process (or thread) at a time. It is crucial to ensure that concurrent access to shared resources
does not lead to data inconsistencies or conflicts. The concept of a critical region is closely related to
ensuring the integrity of shared data.
3. Mutual Exclusion:
Mutual exclusion is a fundamental requirement for the proper implementation of a critical region. It
ensures that only one process or thread can execute the critical section at any given time.

Deadlock:
• Processes block each other from continuing.

• Conditions required for deadlock.

Deadlock in a computing system occurs when two or more processes are unable to proceed because
each is waiting for the other to release a resource. This can happen under certain conditions, and the
three necessary conditions for a deadlock are:

1. Competition for non-sharable resources:


Processes must be contending for resources that cannot be shared. These resources are typically
exclusive, meaning that only one process can use them at a time.

2. Resources requested on a partial basis:


Processes must request resources incrementally, i.e., a process may acquire some resources and then
request additional ones while holding the current ones. If a process cannot obtain all the resources it
needs at once, it may hold resources while waiting for others to become available, leading to potential
deadlock scenarios.

3. An allocated resource cannot be forcibly retrieved:


Once a process holds a resource, it cannot be forcibly taken away. The process can release the resource
voluntarily, but it cannot be forcefully preempted. This condition contributes to the possibility of
deadlock since a process may hold a resource indefinitely if it does not voluntarily release it.

Figure 3.7 A deadlock resulting from competition for non-shareable railroad


intersections
Security:
1. Attacks from Outside:
External attacks, often referred to as external threats or cyberattacks, involve unauthorized attempts to
access or disrupt computer systems, networks, or data from outside sources. These can include various
types of attacks such as hacking, malware, and denial-of-service (DoS) attacks.

Problems:
 Insecure Passwords:
Weak or easily guessable passwords can be exploited by attackers to gain unauthorized access to
systems or accounts.

 Sniffing Software:
Sniffing refers to the unauthorized interception of network traffic to capture sensitive information, such
as usernames and passwords, as it travels over the network.

Countermeasures:
 Auditing Software:
Auditing software is a countermeasure used to monitor and analyze system activities for security and
compliance purposes. It helps in detecting and responding to security incidents. Auditing tools can track
login attempts, access patterns, and changes to critical system files.

 Secure Password Policies:


Implementing strong password policies, including requirements for complex passwords and regular
password changes, can help mitigate the risk of unauthorized access due to weak passwords.

2. Attacks from within:


When dealing with attacks from within a system, one of the problems can be unruly processes,
which refers to processes that behave inappropriately or maliciously. A countermeasure to
address this issue is controlling process activities through privileged modes and privileged
instructions. Let's delve into this:

Problem:
 Unruly Processes:
Unruly processes can include processes that consume excessive system resources, engage in
unauthorized or malicious activities, or attempt to exploit vulnerabilities within the system.
These processes may disrupt the normal functioning of the system and compromise its
integrity, availability, or confidentiality.

Countermeasure:
Control Process Activities via Privileged Modes and Privileged Instructions:

 Privileged Modes:
Modern computer architectures often have different privilege levels or modes, such as user
mode and kernel mode. The kernel mode is a privileged mode that allows direct access to
system resources and critical functions. By controlling access to the kernel mode, the system
can restrict processes from performing certain actions that could compromise system security.

 Privileged Instructions:
Privileged instructions are instructions that can only be executed in privileged modes, typically
restricted to the operating system's kernel. These instructions perform critical operations, and
allowing regular user processes to execute them could lead to security vulnerabilities. By
controlling access to privileged instructions, the system can prevent unauthorized processes
from performing sensitive operations.

You might also like