![Page 1: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/1.jpg)
CISC 7310X
C01b: Overview of Computer Systems and Operating
SystemsHui Chen
Department of Computer & Information Science
CUNY Brooklyn College
1/31/2019 1CUNY | Brooklyn College
![Page 2: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/2.jpg)
Acknowledgement
• This slides are a revision of the slides by the authors of the textbook
1/31/2019 CUNY | Brooklyn College 2
![Page 3: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/3.jpg)
Outline
• Motivational discussion
• Definition of operating systems
• Computer organization overview
• Computer architecture overview
• Operating system structure
• Operating system resources management
• Protection and privacy
• Computing environments
1/31/2019 CUNY | Brooklyn College 3
![Page 4: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/4.jpg)
Discussion Questions?
• Where may you find computers?
• Why do we need to study operating systems?
1/31/2019 CUNY | Brooklyn College 4
![Page 5: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/5.jpg)
Various Computer Systems
1/31/2019 CUNY | Brooklyn College 5
![Page 6: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/6.jpg)
Motivations• There are occasions we are better off to provide a
system solution from ground-up.
• Building a new system
• Extending an existing system
• There are (more) occasions we can only provide a superior “system” solution when we have a good understanding how the system works.
• There are also occasions we can application the solutions (algorithms) in operating systems to application programs
• …
1/31/2019 CUNY | Brooklyn College 6
![Page 7: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/7.jpg)
Discussion Questions
• So, lots of computers … What are in common and what are different? What is a computer system?
1/31/2019 CUNY | Brooklyn College 7
![Page 8: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/8.jpg)
A Computer System: Four Components
1/31/2019 CUNY | Brooklyn College 8
![Page 9: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/9.jpg)
Computer System Components
• Hardware: provides basic computing resources
• CPU, memory, I/O devices
• Operating system
• Controls and coordinates use of hardware among various applications and users
• Application programs: define the ways in which the system resources are used to solve the computing problems of the users
• Word processors, compilers, web browsers, database systems, video games
• Users
• People, machines, other computers
1/31/2019 CUNY | Brooklyn College 9
![Page 10: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/10.jpg)
Questions?
• What are major (top-level) computer system components?
• Does a user always mean a human user?
1/31/2019 CUNY | Brooklyn College 10
![Page 11: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/11.jpg)
Major Hardware Components
• Processors (CPU)
• Multithreaded and multicore processors
• Main Memory (Memory)
• Secondary Memory (Disks)
• I/O Devices
• Buses
1/31/2019 CUNY | Brooklyn College 11
CPU
Bus
MemoryI/O
Devices
![Page 12: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/12.jpg)
Major Hardware Component: An Example
1/31/2019 CUNY | Brooklyn College 12
![Page 13: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/13.jpg)
Storage Structure
1/31/2019 CUNY | Brooklyn College 13
![Page 14: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/14.jpg)
Main Memory and Secondary Storage• Main memory – only large storage media that the CPU can
access directly
• Random access, typically volatile
• Secondary storage – extension of main memory that provides large nonvolatile storage capacity
• Hard disks – rigid metal or glass platters covered with magnetic recording material
• Disk surface is logically divided into tracks, which are subdivided into sectors
• The disk controller determines the logical interaction between the device and the computer
• Solid-state disks – faster than hard disks, nonvolatile
• Various technologies, becoming more popular1/31/2019 CUNY | Brooklyn College 14
![Page 15: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/15.jpg)
Storage Hierarchy
• Storage systems organized in hierarchy
• Speed
• Cost
• Volatility
• Caching – copying information into faster storage system; main memory can be viewed as a cache for secondary storage
• Device Driver for each device controller to manage I/O
• Provides uniform interface between controller and kernel
1/31/2019 CUNY | Brooklyn College 15
![Page 16: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/16.jpg)
Storage-Device Hierarchy
1/31/2019 CUNY | Brooklyn College 16
![Page 17: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/17.jpg)
Performance of Various Levels of Storage• Movement between levels of storage
hierarchy can be explicit or implicit
1/31/2019 CUNY | Brooklyn College 17
![Page 18: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/18.jpg)
Caching
• Important principle, performed at many levels in a computer (in hardware, operating system, software)
• Information in use copied from slower to faster storage temporarily
• Faster storage (cache) checked first to determine if information is there
• If it is, information used directly from the cache (fast)
• If not, data copied to cache and used there
• Cache smaller than storage being cached
• Cache management important design problem
• Cache size and replacement policy
1/31/2019 CUNY | Brooklyn College 18
![Page 19: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/19.jpg)
Questions?
• Tiers of Storage
• How is storage organized?
• Memory/Storage hierarchy
• How does storage-device hierarchy look like? Why is storage organized in this fashion?
• Caching
• What is caching?
1/31/2019 CUNY | Brooklyn College 19
![Page 20: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/20.jpg)
Processor
• CPU = Central Processor Unit
1/31/2019 CUNY | Brooklyn College 20
![Page 21: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/21.jpg)
Processors
1/31/2019 CUNY | Brooklyn College 21
ALU
Program Counter (PC)
Stack Pointer
Program Status Word (PSW)
Other Registers 1
Other Registers nCache
![Page 22: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/22.jpg)
A von Neumann Architecture
1/31/2019 CUNY | Brooklyn College 22
![Page 23: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/23.jpg)
A von Neumann Architecture
1/31/2019 CUNY | Brooklyn College 23
![Page 24: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/24.jpg)
Instructions
• Basic cycle
• Fetch, decode, execute
• Enhance: e.g., pipelining
• Instruction set
• Examples
• x86 (i386 for 32-bit; amd64 for 64-bit)
• ARM
1/31/2019 CUNY | Brooklyn College 24
Fetch Decode Execute
Fetch Decode Execute
![Page 25: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/25.jpg)
Questions?
• Processor
• Instruction set and cycle
1/31/2019 CUNY | Brooklyn College 25
![Page 26: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/26.jpg)
A von Neumann Architecture
1/31/2019 CUNY | Brooklyn College 26
![Page 27: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/27.jpg)
Input and Output (I/O)
• Busy waiting
• Interrupted I/O
• Direct memory access (DMA)
• Discuss more next week
1/31/2019 CUNY | Brooklyn College 27
![Page 28: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/28.jpg)
Questions?
• Concept of I/O and different types of I/O mechanisms
1/31/2019 CUNY | Brooklyn College 28
![Page 29: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/29.jpg)
This is an Example of a Simple System• Many systems use a single general-purpose
processor, but …
1/31/2019 CUNY | Brooklyn College 29
![Page 30: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/30.jpg)
Computer System Architecture
• Many systems use a single general-purpose processor
• Many systems have special-purpose processors as well
• Multiprocessors systems growing in use and importance
• Also known as parallel systems, tightly-coupled systems
• Advantages include:
1. Increased throughput
2. Economy of scale
3. Increased reliability – graceful degradation or fault tolerance
• Two types:
1. Asymmetric Multiprocessing – each processor is assigned a specie task.
2. Symmetric Multiprocessing – each processor performs all tasks
1/31/2019 CUNY | Brooklyn College 30
![Page 31: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/31.jpg)
Architecture: Examples
• Symmetric multiprocessing
• Multi-core design
• Clustered systems
1/31/2019 CUNY | Brooklyn College 31
![Page 32: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/32.jpg)
Symmetric Multiprocessing Architecture
1/31/2019 CUNY | Brooklyn College 32
![Page 33: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/33.jpg)
Multi-chip and Multicore
• Multi-chip and multicore
• Systems containing all chips
• Chassis containing multiple separate systems
1/31/2019 CUNY | Brooklyn College 33
![Page 34: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/34.jpg)
A Dual-Core Design
1/31/2019 CUNY | Brooklyn College 34
![Page 35: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/35.jpg)
Clustered Systems
• Like multiprocessor systems, but multiple systems working together
• Usually sharing storage via a storage-area network (SAN)
• Provides a high-availability service which survives failures
• Asymmetric clustering has one machine in hot-standby mode
• Symmetric clustering has multiple nodes running applications, monitoring each other
• Some clusters are for high-performance computing (HPC)
• Applications must be written to use parallelization
• Some have distributed lock manager (DLM) to avoid conflicting operations
1/31/2019 CUNY | Brooklyn College 35
![Page 36: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/36.jpg)
Clustered Systems: Example
1/31/2019 CUNY | Brooklyn College 36
![Page 37: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/37.jpg)
Questions?
• How does a typical von Neumann architecture look like?
• Types of architecture
1/31/2019 CUNY | Brooklyn College 37
![Page 38: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/38.jpg)
Discussion Question?
• What is an Operating System?
1/31/2019 CUNY | Brooklyn College 38
![Page 39: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/39.jpg)
Operating System Definition: Two Roles• An OS controls and coordinates use of
hardware among various applications and users, and servers two major roles
• As a resource allocator
• Manages all resources
• Decides between conflicting requests for efficient and fair resource use
• As a control program
• Controls execution of programs to prevent errors and improper use of the computer
1/31/2019 CUNY | Brooklyn College 39
![Page 40: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/40.jpg)
Operating System Definition: Two Views• A large piece of software function as
• an extended machine (user view)
• to provide an “beautiful” interface for application programs for application developers
• a resource manager (system view)
• to provide a “beautiful” allocation scheme to share the processors, memories, and I/O devices in a “computer system”
1/31/2019 CUNY | Brooklyn College 40
![Page 41: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/41.jpg)
Operating System
1/31/2019 CUNY | Brooklyn College 41
System Hardware
Operating System
Application 1 Application 2 Application N
App User 1 App User M
User View:System Interface
(System Calls)
App User Interface
System View:Resource Allocation
![Page 42: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/42.jpg)
Did you say, “beautiful”?
• Question & Discussion: what is “beautiful”?
1/31/2019 CUNY | Brooklyn College 42
![Page 43: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/43.jpg)
But, No Universally Accepted Definition • “Everything a vendor ships when you order
an operating system” is a good approximation
• But varies wildly
• “The one program running at all times on the computer” is the kernel.
• Everything else is either
• a system program (ships with the operating system) , or
• an application program.
1/31/2019 CUNY | Brooklyn College 43
![Page 44: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/44.jpg)
Questions
• Concept of operating systems
• Two roles
• Two views
• Is there a universally accepted definition? But, what is universally accepted?
1/31/2019 CUNY | Brooklyn College 44
![Page 45: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/45.jpg)
Operating System Structure
• Multiprogramming (Batch system) needed for efficiency
• Single user cannot keep CPU and I/O devices busy at all times
• Multiprogramming organizes jobs (code and data) so CPU always has one to execute
• A subset of total jobs in system is kept in memory
• One job selected and run via job scheduling
• When it has to wait (for I/O for example), OS switches to another job
• Timesharing (multitasking) is logical extension in which CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing
• Response time should be < 1 second
• Each user has at least one program executing in memory process
• If several jobs ready to run at the same time CPU scheduling
• If processes don’t fit in memory, swapping moves them in and out to run
• Virtual memory allows execution of processes not completely in memory1/31/2019 CUNY | Brooklyn College 45
![Page 46: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/46.jpg)
Memory Layout for Multiprogrammed System
1/31/2019 CUNY | Brooklyn College 46
![Page 47: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/47.jpg)
Operating-System Operations
• Interrupt driven (hardware and software)
• Hardware interrupt by one of the devices
• Software interrupt (exception or trap):
• Software error (e.g., division by zero)
• Request for operating system service
• Other process problems include infinite loop, processes modifying each other or the operating system
1/31/2019 CUNY | Brooklyn College 47
![Page 48: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/48.jpg)
Operating-System Operations
• Dual-mode operation allows OS to protect itself and other system components
• User mode and kernel mode
• Mode bit provided by hardware
• Provides ability to distinguish when system is running user code or kernel code
• Some instructions designated as privileged, only executable in kernel mode
• System call changes mode to kernel, return from call resets it to user
• Increasingly CPUs support multi-mode operations
• i.e. virtual machine manager (VMM) mode for guest VMs
1/31/2019 CUNY | Brooklyn College 48
![Page 49: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/49.jpg)
Processors
1/31/2019 CUNY | Brooklyn College 49
ALU
Program Counter (PC)
Stack Pointer
Program Status Word (PSW)
Other Registers 1
Other Registers nCache
Kernel mode: can execute all instructions and access all hardware features
User mode: can execute subset of instructions and access subset of hardware features
![Page 50: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/50.jpg)
Transition from User to Kernel Mode• Timer to prevent infinite loop / process hogging
resources
• Timer is set to interrupt the computer after some time period
• Keep a counter that is decremented by the physical clock.
• Operating system set the counter (privileged instruction)
• When counter zero generate an interrupt
• Set up before scheduling process to regain control or terminate program that exceeds allotted time
1/31/2019 CUNY | Brooklyn College 50
![Page 51: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/51.jpg)
Transition from User to Kernel Mode
1/31/2019 CUNY | Brooklyn College 51
![Page 52: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/52.jpg)
Questions?
• Operating system structure
• Dual mode (kernel and user mode)
• Transition from use to kernel mode
1/31/2019 CUNY | Brooklyn College 52
![Page 53: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/53.jpg)
Operating System Resource Management• Process management
• Memory management
• Storage management
• Mass-storage (disk) management
• I/O subsystem
• Protection and privacy
1/31/2019 CUNY | Brooklyn College 53
![Page 54: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/54.jpg)
Process Management
• A process is a program in execution. It is a unit of work within the system. Program is a passive entity, process is an active entity.
• Process needs resources to accomplish its task
• CPU, memory, I/O, files
• Initialization data
• Process termination requires reclaim of any reusable resources
• Single-threaded process has one program counter specifying location of next instruction to execute
• Process executes instructions sequentially, one at a time, until completion
• Multi-threaded process has one program counter per thread
• Typically system has many processes, some user, some operating system running concurrently on one or more CPUs
• Concurrency by multiplexing the CPUs among the processes / threads
1/31/2019 CUNY | Brooklyn College 54
![Page 55: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/55.jpg)
Process Management Activities
• The operating system is responsible for the following activities in connection with process management:
• Creating and deleting both user and system processes
• Suspending and resuming processes
• Providing mechanisms for process synchronization
• Providing mechanisms for process communication
• Providing mechanisms for deadlock handling
1/31/2019 CUNY | Brooklyn College 55
![Page 56: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/56.jpg)
Memory Management• To execute a program all (or part) of the instructions must be
in memory
• All (or part) of the data that is needed by the program must be in memory.
• Memory management determines what is in memory and when
• Optimizing CPU utilization and computer response to users
• Memory management activities
• Keeping track of which parts of memory are currently being used and by whom
• Deciding which processes (or parts thereof) and data to move into and out of memory
• Allocating and deallocating memory space as needed
1/31/2019 CUNY | Brooklyn College 56
![Page 57: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/57.jpg)
Storage Management
• OS provides uniform, logical view of information storage
• Abstracts physical properties to logical storage unit - file
• Each medium is controlled by device (i.e., disk drive, tape drive)
• Varying properties include access speed, capacity, data-transfer rate, access method (sequential or random)
• File-System management
• Files usually organized into directories
• Access control on most systems to determine who can access what
• OS activities include
• Creating and deleting files and directories
• Primitives to manipulate files and directories
• Mapping files onto secondary storage
• Backup files onto stable (non-volatile) storage media
1/31/2019 CUNY | Brooklyn College 57
![Page 58: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/58.jpg)
Mass-Storage Management• Usually disks used to store data that does not fit in main memory or data that must
be kept for a “long” period of time
• Proper management is of central importance
• Entire speed of computer operation hinges on disk subsystem and its algorithms
• OS activities
• Free-space management
• Storage allocation
• Disk scheduling
• Some storage need not be fast
• Tertiary storage includes optical storage, magnetic tape
• Still must be managed – by OS or applications
• Varies between WORM (write-once, read-many-times) and RW (read-write)
1/31/2019 CUNY | Brooklyn College 58
![Page 59: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/59.jpg)
Migration of Data from Disk to Register• Multitasking environments must be careful to use most recent
value, no matter where it is stored in the storage hierarchy
• Multiprocessor environment must provide cache coherency in hardware such that all CPUs have the most recent value in their cache
• Distributed environment situation even more complex
• Several copies of a datum can exist
• Various solutions covered in Chapter 17
1/31/2019 CUNY | Brooklyn College 59
![Page 60: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/60.jpg)
I/O Subsystem
• One purpose of OS is to hide peculiarities of hardware devices from the user
• I/O subsystem responsible for
• Memory management of I/O including buffering (storing data temporarily while it is being transferred), caching (storing parts of data in faster storage for performance), spooling (the overlapping of output of one job with input of other jobs)
• General device-driver interface
• Drivers for specific hardware devices
1/31/2019 CUNY | Brooklyn College 60
![Page 61: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/61.jpg)
Computer Startup
• bootstrap program is loaded at power-up or reboot
• Typically stored in ROM or EPROM, generally known as firmware
• Initializes all aspects of system
• Loads operating system kernel and starts execution
1/31/2019 CUNY | Brooklyn College 61
![Page 62: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/62.jpg)
Protection and Security
• Protection – any mechanism for controlling access of processes or users to resources defined by the OS
• Security – defense of the system against internal and external attacks
• Huge range, including denial-of-service, worms, viruses, identity theft, theft of service
• Systems generally first distinguish among users, to determine who can do what
• User identities (user IDs, security IDs) include name and associated number, one per user
• User ID then associated with all files, processes of that user to determine access control
• Group identifier (group ID) allows set of users to be defined and controls managed, then also associated with each process, file
• Privilege escalation allows user to change to effective ID with more rights
1/31/2019 CUNY | Brooklyn College 62
![Page 63: CISC 7310X C01b: Overview of Computer Systems and Operating … · 2020-02-03 · CISC 7310X C01b: Overview of Computer Systems and Operating Systems Hui Chen Department of Computer](https://reader033.vdocuments.us/reader033/viewer/2022041909/5e66599ca4a99b390e46563d/html5/thumbnails/63.jpg)
Questions?
• How does an OS manage the computer resources?
• Process management
• Memory management
• Storage management
• Mass-storage (disk) management
• I/O subsystem
• Protection and privacy
• How is an operating system loaded?
1/31/2019 CUNY | Brooklyn College 63