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

Lecture 1 - 23SU - Operating System Introduction

The document provides an overview of advanced operating systems. It discusses why operating systems are studied, including their role in resource management, application development, system administration, and security. It then defines what an operating system is and describes common types including batch, time-sharing, real-time, and embedded operating systems. The basics of operating system concepts are introduced such as computer system operation, storage structure, I/O structure, and device drivers. Computer system architectures including single processor, multiprocessor, and clustered systems are also covered. Finally, operating system services and the general process of program execution are summarized.

Uploaded by

Cheserem Titus
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)
13 views

Lecture 1 - 23SU - Operating System Introduction

The document provides an overview of advanced operating systems. It discusses why operating systems are studied, including their role in resource management, application development, system administration, and security. It then defines what an operating system is and describes common types including batch, time-sharing, real-time, and embedded operating systems. The basics of operating system concepts are introduced such as computer system operation, storage structure, I/O structure, and device drivers. Computer system architectures including single processor, multiprocessor, and clustered systems are also covered. Finally, operating system services and the general process of program execution are summarized.

Uploaded by

Cheserem Titus
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/ 45

ADVANCED OPERATING SYSTEM

CPSC8735-04-23SP
LECTURE 1

• Brief Background of Computer System Architecture


• Introduction to Operating System
WHY DO WE STUDY OPERATING SYSTEM?

It provides a foundational understanding of:


Computer systems – OS bridges between software programs and underlying hardware of computer system. Learning OS help gaining
understanding how components such as CPU, memory, disks and other peripherals interact with each other.
Resource management – OS handles CPU scheduling, memory management, files organization and other techniques for optimization
of system resources, which are essential for developing efficient and robust software applications.
Application development – OS provides platform for developing and executing applications, so it enables the developers to utilize
system services, work with device drivers, handles concurrency and synchronization, write code to interact with OS kernels.
System administration – OS is the backbone of computer networks and server environments. Studying OS equips system
administrators to configure security settings, monitor system performance, troubleshoot issues, and ensure the stability and reliability of
the overall system.
System Security: OS plays a critical role in maintaining the security of a computer system. By studying operating systems, the
developers gain insights into security mechanisms, authentication protocols, access control, and vulnerability management.
OS research and development - Researchers explore new algorithms, architectures, and techniques to improve performance,
scalability, security, and reliability. Understanding OS enables you to participate in this exciting area and drive innovation.
• What is operating system?

Operating system manages all software and hardware on the computer. It performs
OPERATING basic tasks such as file, memory and process management, handling input and
output, and controlling peripheral devices such as disk drives and printers.
SYSTEM
INTRODUCTION
Batch OS
Mainframe: payroll system
Bank statement system
Time-sharing OS
Unix, Linux,Windows NT
AIX, Solaris

TYPES OF OPERATING SYSTEMS 1


TYPE OF OPERATING SYSTEMS 2

MS-DOS, Windows and Unix


are mostly widely used NOS

Air traffic control system, autonomous driving system


BASICS OF OPERATING SYSTEM 1

Computer System Operation


• In order to understanding how operating system works, we must have a big picture of structure of computer
system.
• A modern general-purpose computer system consists of one or more CPUs and a number of device
controllers connected through a common bus that provides access to shared memory.
BASIC OF OPERATING SYSTEM 2

Computer System Operation


Ø Each device controller is in charge of a specific type of device. It is a hardware unit attached to I/O bus acting
as an interface between device and device driver (software installed in OS).
Ø The CPU and the device controllers can execute concurrently, competing for memory cycles.
Ø To ensure orderly access to the shared memory, a memory controller is provided to synchronize access to
the memory.
Ø Important Terms:
• Bootstrap Program:
o It is the first program the computer system run when being powered up or reboot.
o It locates in Read Only Memory (ROM, non-volatile, in a microchip in motherboard).
o It knows where and how to load the OS and start executing OS.
o It loads OS kernel from disk into the memory, placed it at the very beginning of the memory.
BASICS OF OPERATING SYSTEM 3

Computer System Operation


• Interrupt:
o The occurrence of an event (keystroke or mouse moving or open file) is usually signaled by an Interrupt.
o The interrupt can be emitted from either hardware (keystroke) or software (read/write file)
o Hardware may trigger an interrupt at any time by sending a signal to the CPU, usually through the system
bus.
• System Call:
o Software can trigger an interrupt by executing a special operation named system call.
o It is the bridge through which user program request the hardware resource.
Ø When an interrupt takes place, the CPU stops what it is doing and immediately transfers execution to a fixed
location where an interrupt handler (service routine) reside.
Ø The Interrupt Service Routine executes.
Ø On completion, the CPU resumes the interrupted execution of user process.
BASIC OF OPERATING SYSTEM 4

• Storage Structure
BASICS OF OPERATING SYSTEM 5

• I/O Structure
• Storage is only one of many types of I/O devices within a computer
• A large portion of operating system code is dedicated to managing I/O, because of the importance
of the reliability and performance of a computer system and the varying nature of the devices.
• A computer system consists of CPUs and multiple device controllers that are connected through a
common bus.
• Each device controller is in charge of a specific type of device.
• The device controller maintains 1) Local Buffer Storage and 2) a set of special purpose registers.
• Typically, operating system have a device driver for each device controller.
• Device driver is software. It understands the device controller and presents an interface between
the device and the rest of operating system.
Device Driver and Device Controller
COMPUTER SYSTEM ARCHITECTURE 1

The types of computer systems based on number of


General-Purpose Processor:
ØSingle Processor Systems
ØMultiprocessor Systems
ØClustered Systems
COMPUTER SYSTEM
ARCHITECTURE 2

• Single Processor System


A single processor system contains only one processor.
So only one process can be executed at a time and then
the process is selected from the ready queue.
Multiprocessor Systems – 2 types
• Symmetric multiprocessing
is computer processing done by multiple COMPUTER SYSTEM
processors that share a common operating ARCHITECTURE 3
system and memory. The processors share
the same input/output (I/O) bus or data
path. A single copy of the OS is in charge of
all the processors. The processors are
homogenous.
• The processors in asymmetric
multiprocessing have a master-slave
relationship, with one master processor
controlling the other slave processors. The
slave processors may receive specified tasks
from the master processor or receive
processes from the master processor. The
master processor manages the data
structure, the scheduling of processes, I/O
processing, and other system operations.
COMPUTER SYSTEM ARCHITECTURE 4

Clustered Systems
• Like multiprocessor systems, clustered systems gather multiple CPUs to accomplish
computational work.
• However, they are composed of two or more individual systems coupled together.
• They provide high availability.
• They can be structured asymmetrically or symmetrically.
o Asymmetrical – hot-standby configured. The standby system monitors the hot-running
system.
o Symmetrical – hot-hot configured. The systems monitor each other.
• The systems can be hardware clustered (to enable high-performance disk sharing)
or software clustered (to allow all systems working together).
OPERATING
SYSTEM SERVICES

• An OS provides an environment for the program execution.


It provides certain services to the programs or users.
• User Interface: CLI or GUI
• Program Execution (top diagram on the left)
• I/O Operation (bottom diagram on the left)
• File System Manipulation
• Communication: inter-process communication, pipe
• Error Detection: divide by zero; file cannot be opened
• Resource Allocation: run a program based on its hardware
requirement such as computation, energy, network etc.
• Accounting: tracking users and their computer resource
usage.
• Protection and Security: permission
WHAT A
COMPUTER
PROGRAM
DOES WHEN
IT RUNS?
WHAT A COMPUTER PROGRAM
DOES WHEN IT RUNS? 1

1. The loader of OS load the program – already compiled


from source code into object in machine language – from
disk to main memory RAM.
2. The entry point of the program is stored in a register
named Program Counter (PC). CPU has a few registers
which are the minimum memory units used to store a
number or machine language instruction. PC is one of the
registers.
3. RAM consists of a sequence of locations, which are
numbered, named as address. Both instruction and data
of a program are stored in RAM.
WHAT A COMPUTER PROGRAM
DOES WHEN IT RUNS? 2

• 4. CPU, the computer component in a chip doing all the calculation


and execution and control, starting from the entry point, keeps
reading instruction and data from RAM to CPU (Fetch-and-Execute
Cycle). The PC is constantly updated with the address of the next
instruction.
• 5. The computers are built with millions of transistors, which have
two states: on or off. These transistors are wired together in a way
that the output of one transistor can turn the next switch on or off.
The machine language instructions are binary codes, 1 representing on
and 0 representing off. When a program is loaded in, the CPU is built
to respond the pattern and figure out what to do. This process is
called decoding. So, the execution cycle is expanded to Fetch-
Decode-Execution.
• 6. The CPU keeps loading, decoding, executing until it reaches the end
of the program. Sometimes, CPU will store value into RAM, as
instructed by the program.
Control Unit - regulates and integrates the
Arithmetic/Logic Unit - carries out
operations of the computer. It selects and
retrieves instructions from the main memory in arithmetic and bitwise logic operations VON NEUMANN
on the operands in computer
proper sequence and interprets them so as to
activate the other functional elements of the instruction words MODEL
system at the appropriate moment

• Computer Architecture, by John Von


Neumann in 1945
• CPU: 2 Units and a group of Registers
• PC: Program Counter, storing address of
instruction to be executed next
• CIR/IR: Current Instruction Register,
holding instruction that is currently
executed or decoded.
• AC:Accumulator Counter, holding short-
term and temporary arithmetic/logic data
• MAR: Memory Address Register, containing
the memory address from which data will be
fetched, or to which the data will be stored.
• MDR: Memory Buffer(Data) Register,
storing the data being transferred to and
from the immediate access storage
(addressed in MAR)
WHAT IS OPERATING SYSTEM?

OS is a software program to ensure a user program or programs to


share the memory, interact with the devices and executed correctly,
efficiently and easily.
OS is sitting between computer hardware and the application
programs or program. It provides a virtualization interface to make
the programmer’s life easy so that programmer does not have to
directly interact with hardware, which are complex, intricate and
different with each of them.
OS is a resource manager which allows concurrent user programs
to share the hardware resources such as CPU, RAM and all kinds of
I/O devices.
It ensures the information can be persistently stored in a computer
system.
Hence are the 3 themes of OS: Virtualization, Concurrency and
Persistence.
OS takes the physical resources such as CPU, RAM, DISK and
transform them into virtual form so they are general, powerful and
easy-to-use. OS sometimes is therefore referred as Virtual
Machine.
Examples:
• Make a single physical CPU acting like multiple CPUs so that
many processes can run concurrently on CPU, seemingly one on
each CPU.
THEME 1 - • Make physical memory (RAM) to look like multiple virtual
V I RT UA L I Z AT I O N memory spaces, and each process sit in a large and private
virtual memory spaces
• Make physical disk look like a file system. Physical disk are arrays
of raw bytes, while file system is a user’s view of data on disk,
making it easy for user program to read/write with the disk.
VIRTUALIZING
CPU – CODE
EXAMPLE

• cpu.c – take user string input,


enter into a loop, print the user
input at 1 sec interval.
PID

process

VIRTUALIZING CPU – CODE EXAMPLE


VIRTUALIZING
MEMORY –
CODE EXAMPLE

• Mem.c
• Allocate a chunk of memory
thru ‘malloc()’ to P
• Print the address of memory
stored in p
• Zero out the value of P
• Enter into a loop
• Increment value of pointer P
PID

VIRTUALIZING MEMORY – CODE


EXAMPLE
Virtualization allows multiple concurrent programs to
share the virtualized hardware resources, which brings the
2nd theme – concurrency.
Examples:
One physical CPU runs many processes
One process runs many threads
THEME 2 -
CONCURRENCY One CPU handles processes execution, system calls,
interrupts, exceptions, CPU scheduling, memory
management, etc.
Modern computer systems contains a lot of concurrency.
Concurrency is the source of most of the system
complexity.
CONCURRENCY
– CODE
EXAMPLE

• Thread.c
• Create two threads p1, p2
• Two threads print the initial
value of counter
• Each thread loops x times
concurrently
• After loop, two threads print
again the value of counter
Concurrency:
Shared counter
Protection

CONCURRENCY – CODE EXAMPLE


RAM – volatile, data can be easily lost;
Store data forever – on disk, SSD, CD, floppy disks, tapes, and
paper
• Storing them into raw bytes is not enough
• User wants to access the data easily, read and write easily,
manage data easily and share the data easily, recover data
easily, and protect data from being stolen.
THEME 3 -
PERSISTENCE • File System is part of OS in charge of managing data
persistence
• Different from virtualizing CPU and memory where each
process need isolation, user often wants to share the data
• File system handles the technique to persist data correctly,
implement mechanism and define policy to make operation
efficient, and handle the data persistence reliably.
File system is part of OS. OS provide a standard library
in which contains many system calls. User program
invokes these system calls to operate various kind of
devices, without knowledge of the complexities of
PERSISTENCY – devices. OS route the system calls to the file system,
which communicate with different devices through
CODE EXAMPLE device driver.

• Io.c
• Open a file (return a file
descriptor)
• Writing data over
• Close the file descriptor and
complete writing emacs –nw io.c //create a new file io.c
gcc –o io io.c //compile file io.c to executable io
• The file can be shared
./ io // execute object file

From above example, we can see a file can be accessed by different


processes such as editor “emacs”, and compiler “gcc” and executor.
OPERATING
SYSTEM
CONTENTS

OS virtualize hardware resources (CPU, Memory, Disk etc.), and


handles complexities of concurrency, and manages file persistence for
long term.
Finding the right set of trade-off is the key to build
OS:
• Abstraction – fundamental of OS, with the
purpose to make the system convenient and easy
to use (so you can code in C and forget about
assembly à logic gate à transistor)
• High Performance – reduce overhead such as
extra time or space
DESIGN GOAL • Protection/isolation – between applications,
between application and OS, between processes
• Reliability – failure
• Energy efficiency
• Security
• Mobility
Depending on how the system is used, the goals
could be different thus the implementation.
MECHANISM & POLICY

• Virtualization allows multiple programs to


run, and allow the resources being shared.
Who runs first?
• Question like above is decided by ‘Policy’.
Policy determine which/what will be done in
OS.
• Mechanism determines how it will be done
in OS. It is the implementation of policy.
• An important principle is the separation of
policy from mechanism.
OS HISTORY 1

q 1950s - 1960s: Early operating systems were simple batch


processing systems
Unix:
• Users provided their own “OS” as libraries. • Unifying principle of building small powerful
q 1960s and 1970s: Multi-programming on mainframes programs that could be connected together to
• Concurrency, memory protection, Kernel mode, system calls, form a large workflow: grep foo file.txt | wc -l
hardware privilege levels, trap handling (shell and pipe)
• Friendly environment by providing compiler for C
• Earliest Multics hardware and OS on IBM mainframes
language which is easy to write and share the
• Which led to the first UNIX OS that pioneered file systems, kernel code.
shell, pipes, and the C language. • Early form of open-source software.
q 1980s:Personal computing era • Lead to BSD which provides advanced virtual
memory, file system and networking subsystems
• MacOS, IBM PC and its DOS, Windows, and so forth
à Sun Microsystems.
• Unfortunately, many lessons from earlier multi-programming • Base for Apple Mac OS (because Steve Jobs took
era were forgotten and had to be re-learned (painfully). Unix-based NeXTStep OS to Apple)
OS HISTORY 2

• 1980s also saw the fragmentation of UNIX


• Each big company had its own version (IBM, Apple, HP,
SUN, SGI, NCR, AT&T....)
• LOT of legal wrangling over IP and copyrights Linux
• By Finnish hacker Linus Torvalds
q 1990s: Then came BSD (Berkeley) and Linux
• Originate from Unix but enlist GNU toolchain
• Open source. • Adopted by Google, Facebook,Amazon etc. because
of free and easy to change
• Led the way to modern OSes and cloud platforms
• Solid foothold in mobile world via Android
• 1990s also saw wider adoption of threads and parallelism
q 2000 and beyond: Mobile device OS and hypervisors
• Android, iOS
• VMWare ESX, Xen, Linux/KVM etc.
KERNEL

• is the core of an OS (system


library)
• Provide the most basic interface
between computer system and
the rest of OS (door)
• Responsible for the management
of CPU
Kernel space is the area of system
memory reserved for kernel. It is
where the kernel runs and
executes kernel mode instruction.
USER MODE VS.
KERNEL MODE

A CPU in running has two different


modes: user mode and kernel mode.
The processor switches between
the two modes depending on what
type of code is running on the
processor.
Applications run in user mode, and
core operating system components
run in kernel mode: Anything
involving process management, IO
hardware management, and
memory management necessitates
the execution of processes in
Kernel mode.n Kernel mode.
SYSTEM CALL

A system call is a method for a computer program to request a service


from the kernel of the OS on which it is running (process).
There are many system calls (hundreds, 2,000 for windows) and different
type of system calls.
1. A user process is running in user mode
2. User process invokes a system call, e.g. read/write, a hardware
instruction “interrupt” is emitted.
3. The CPU switch to kernel mode and execute the privileged operation
by invoking pre-specified “interrupt handler”, which is forbidden to the
user process in user mode.
4. CPU switch back to user mode. OS returns control to the user
process. The user process resumes from where it was interrupted.
OS provides standard and simple way to access the device driver
(hardware such as disk) through its system calls.
Thus, OS is sometimes called standard library.
Time-sharing

Multiprogramming - keep multiple jobs in the memory


so that CPU always have something to execute thus
increase utilization. While a job is completed or on I/O,
CPU is assigned to another job. Unbounded-waiting.

Multitasking – a type of multiprogramming. CPU executing


multiple jobs by switching them quickly at fix-amount-time
interval that the user feel they are interacting with all the
tasks at the same time. Bounded-waiting. Goal is to reduce
response time and avoid starvation.

MULTIPROGRAMMING VS. MULTITASKING


MULTI-PROCESSING

• Hardware concept (vs. Multi-programming


and multi-tasking are software concepts,
about scheduling)
• Multiple processors
• Parallel processing
• The goal is to get more work done in a
short period of time
• Increased scalability
V I RT UA L M ACH I N E
M O N I TO R
( H Y P E RV I SO R )

• What is it? Hypervisor is


another layer of indirection
between guest OS and local
OS/Machine.
• Why hypervisor? Consolidate
multiple OSes, employ
functionalities of multiple OS,
easily test cross-platform
applications.
• How it does: virtualizing CPU
and Memory at Machine
Switch Level (Guest OS)

https://www.youtube.com/watch?v=FZR0rG3HKIk&ab_channel=IBMTechnology
LAB & HOMEWORK
INSTALLING KALI LINUX ON WINDOWS OR
MAC OS
• Firstly, install a hypervisor. Popular hypervisors are VMware Fusion, Parallel Desktop, Oracle
VirtualBox, and VMware Workstation. You download a free version into your laptop (for
example, I downloaded free VMware Fusion for my Mac). VirtualBox is free. Some licensed
version such as VMware workstation pro may grant you free access to the students (version
16) or give you certain days trial (latest version 17).
• Then you install Kali Linux on your hypervisor. Here is the YouTube video showing how to
install Kali Linux on VMware workstation on windows:
https://www.youtube.com/watch?v=cT1wxs6rNrE&ab_channel=Tutorials4view
• This YouTube video shows how to install Kali Linux on VirtalBox:
https://www.youtube.com/watch?v=r64S3ivdNRo&ab_channel=GEEKrarGuides
REFERENCE

• 1. Operating System: Three Easy Pieces by Remzi H. Arpaci-Dusseau and


Andrea C. Arpaci-Desseau
• 2. Nesco Academy at https://nesoacademy.org/
• 3. Dr. Hui Liu at Bing Hampton Univ.at
https://www.cs.binghamton.edu/~huilu/cs350/
• 4. Geek for Geek https://www.geeksforgeeks.org/
• 5. Microsoft https://www.Microsoft.com
• Guru99 at https://guru99.com

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy