Master Computer Science The Smart Way

Principles of Operating Systems: Introduction & Background (Part 02)

Principles of Operating Systems: Introduction & Background (Part 02)
0

Welcome to the second Part on the Principles of Operating Systems! In this comprehensive article, we delve deeper into the fundamental concepts that define operating systems, their functions, services, and the various types that power our digital world. Building upon our previous discussion, we’ll explore the intricate relationship between hardware and software, the role of the operating system as a resource manager, and the essential services that make modern computing possible.


Topics Covered in This Lecture

  • What is an Operating System?
  • Functions and Services of OS
  • Types of Operating Systems
  • Computing Environments
  • Kernel Data Structures
  • Computer System Organization
  • Storage Hierarchy
  • User Interfaces (CLI, GUI, Touchscreen)
  • Process Management
  • Memory Management
  • File System Management
  • Mass-Storage Management
  • Protection and Security

What is an Operating System? – A Deeper Look

No Universally Accepted Definition

The concept of an operating system is fluid and varies depending on who you ask. Here are some perspectives:

PerspectiveDefinition
Vendor’s View“Everything a vendor ships when you order an operating system” – but this varies wildly between vendors
Kernel View“The one program running at all times on the computer” – the kernel, which is part of the operating system
System Program ViewSystem programs that ship with the OS but are not part of the kernel
Application Program ViewAll programs not associated with the operating system

Modern OS Components

Today’s operating systems for general-purpose and mobile computing also include middleware – a set of software frameworks that provide additional services to application developers, such as:

  • Databases
  • Multimedia frameworks
  • Graphics libraries
  • Networking protocols

The Digital Control Room: OS as Conductor

The Hardware Baseline

The computer system consists of:

  • One or more CPUs
  • Device controllers
  • Common bus providing access to shared memory
  • Concurrent execution of CPUs and devices competing for memory cycles

The Inherent Tension

When multiple components are simultaneously fighting for the same memory and computing power, the question arises: Who orchestrates the chaos?

Answer: The Operating System acts as the conductor. Without a conductor, the instruments simply make noise.


Functions of the Operating System

1. Resource Manager

The OS manages hardware and software resources including:

  • CPU and memory
  • I/O devices
  • Registers
  • Device drivers
  • Semaphores
  • Mutexes

2. Control Program

The OS controls the execution of programs to prevent errors and improper use of the computer.

3. Set of Utilities

The OS provides tools to simplify application development.

4. Government Metaphor

The OS acts like a government, managing resources, resolving conflicts, and providing services.


Computer System Organization

System Operation Components

ComponentDescription
CPUCentral Processing Unit – executes instructions
Device ControllersManage specific devices (disk, network, etc.)
Common BusProvides shared memory access
RegistersSmall, fast storage locations within the CPU

Block Diagram of the Control Unit

The Control Unit coordinates the sequence of data movements and performs several critical functions:

Functions of the Control Unit

  1. Coordinates sequence of data movements into, out of, and between a processor’s sub-units
  2. Interprets instructions
  3. Controls data flow inside the processor
  4. Receives external instructions and converts them to control signals
  5. Controls execution units (ALU, data buffers, registers)
  6. Handles multiple tasks: fetching, decoding, execution handling, and storing results

Types of Control Units

TypeDescription
Hardwired Control UnitUses fixed hardware circuits for control signals
Microprogrammable Control UnitUses microprogramming to generate control signals

Storage Hierarchy

Characteristics of Various Types of Storage

LevelNameTypical SizeImplementation TechnologyAccess Time (ns)Bandwidth (MB/sec)Managed ByBacked By
1Registers< 1 KBCustom memory with multiple ports0.25-0.5020,000-100,000CompilerCache
2Cache< 16 MBCMOS on-chip or off-chip SRAM0.5-255,000-10,000HardwareMain Memory
3Main Memory< 64 GBCMOS SRAM80-2501,000-5,000Operating SystemDisk
4Solid-State Disk< 1 TBFlash Memory25,000-50,000500Operating SystemDisk
5Magnetic Disk< 10 TBMagnetic Disk5,000,00020-150Operating SystemDisk or Tape

Note: Movement between levels of storage hierarchy can be explicit or implicit.


What Operating Systems Do – Different Perspectives

User Perspective

User TypeExpectations
General UsersConvenience, ease of use, good performance
Shared Computer UsersFair resource allocation, responsiveness
Dedicated System UsersDedicated resources, but may use shared resources
Mobile Device UsersOptimized for usability and battery life
Embedded SystemsRun primarily without user intervention

System Perspective

  • Resource Allocator: Efficient use of hardware resources
  • Control Program: Managing execution of user programs
  • Efficiency: Optimal resource utilization
  • Convenience: User-friendly interfaces
  • Robustness: System stability and fault tolerance
  • Reliability: Consistent and dependable operation
  • Scalability: Ability to grow with demands
  • Portability: Working across different hardware platforms

Operating System Services

User-Oriented Services

ServiceDescription
User InterfaceCLI, GUI, touch-screen, or batch interface
Program ExecutionLoad programs into memory and execute them
I/O OperationsHandle input/output operations for running programs
File-System ManipulationRead, write, create, delete files and directories
CommunicationsExchange information between processes (shared memory or message passing)
Error DetectionConstant awareness of errors and appropriate handling

System-Oriented Services

ServiceDescription
Resource AllocationAllocate CPU cycles, memory, file storage, I/O devices
LoggingTrack user resource usage
ProtectionControl access to system resources
SecurityUser authentication, defense against external attacks

User Operating System Interfaces

1. Command Line Interface (CLI)

FeatureDescription
Direct Command EntryUsers type commands directly
ImplementationSometimes in kernel, sometimes as system program
FlavorsMultiple shells available
FunctionFetches and executes user commands
ExtensibilityAdding new features doesn’t require shell modification

Example CLI Session:

text

[root@r6181-d5-us01 ~]# uptime
06:57:48 up 16 days, 10:52, 3 users, load average: 129.52, 80.33, 56.55

[root@r6181-d5-us01 ~]# df -kh
Filesystem              Size  Used Avail Use% Mounted on
/dev/mapper/vg_ks-1v_root  50G   19G   28G  41% /
tmpfs                   127G  520K  127G   1% /dev/shm
/dev/sda1               477M   71M  381M  16% /boot

2. Graphical User Interface (GUI)

FeatureDescription
MetaphorUser-friendly desktop metaphor
InteractionMouse, keyboard, and monitor
IconsRepresent files, programs, actions
OriginsInvented at Xerox PARC
ExamplesMicrosoft Windows, Mac OS X, Linux (CDE, KDE, GNOME)

3. Touchscreen Interfaces

FeatureDescription
Gesture-BasedActions and selection based on gestures
Virtual KeyboardText entry via on-screen keyboard
Voice CommandsSpeech recognition for commands

Process Management

The operating system is responsible for the following activities in connection with process management:

ActivityDescription
Creating ProcessesCreating and deleting both user and system processes
Suspending/ResumingSuspending and resuming processes
SynchronizationProviding mechanisms for process synchronization
CommunicationProviding mechanisms for process communication
Deadlock HandlingProviding mechanisms for deadlock handling

Memory Management

Purpose of Memory Management

  • To execute a program, all (or part) of the instructions must be in memory
  • All (or part) of the data needed by the program must be in memory
  • Optimizing CPU utilization and computer response to users

Memory Management Activities

ActivityDescription
TrackingKeeping track of which parts of memory are currently being used and by whom
Decision MakingDeciding which processes (or parts thereof) and data to move into and out of memory
AllocationAllocating and deallocating memory space as needed

File-System Management

Logical View of Storage

The OS provides a uniform, logical view of information storage by abstracting physical properties to a logical storage unit called a file.

Medium Characteristics

PropertyExamples
Access SpeedVaries by medium
CapacityVaries by medium
Data-Transfer RateVaries by medium
Access MethodSequential or random

File-System Management Activities

ActivityDescription
Creating/DeletingCreating and deleting files and directories
ManipulationPrimitives to manipulate files and directories
MappingMapping files onto secondary storage
BackupBackup files onto stable storage media
Access ControlDetermining who can access what

Mass-Storage Management

Importance

  • Disks store data that doesn’t fit in main memory or must be kept for extended periods
  • Entire speed of computer operation hinges on disk subsystem and its algorithms

OS Activities for Mass-Storage Management

ActivityDescription
Mounting/UnmountingManaging file system mounting
Free-Space ManagementTracking and managing free space on storage devices
Storage AllocationAllocating storage space to files
Disk SchedulingOptimizing disk access requests
PartitioningDividing disks into logical partitions
ProtectionControlling access to storage devices

Protection and Security

Protection

Definition: Any mechanism for controlling access of processes or users to resources defined by the OS.

Security

Definition: Defense of the system against internal and external attacks.

Security Threats

Threat TypeExamples
Denial-of-ServiceOverwhelming system resources
MalwareWorms, viruses
Identity TheftStealing user credentials
Theft of ServiceUnauthorized use of system resources

User Identification

ConceptDescription
User IDUser identity includes name and associated number, one per user
Group IDAllows set of users to be defined and controls managed
Privilege EscalationAllows user to change to effective ID with more rights
Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Privacy & Cookies Policy