By Mohamed Gamal
Lecture 2: Computer
System Structure
Operating System
– What’s an Operating System (OS)?
– What’re the three well-known OSes existing today?
– What’re the main basic operations of the computer?
– What’re the main computer system components?
Test your knowledge ?
– What’s the difference between multiprocessing and
multiprogramming?
– What’s the difference between Application Programs and
System Programs?
– What’s the difference between LAN and WAN?
– Explain Grid Systems concept and its derivatives.
– CMD Revision.
Test your knowledge ?
The topics of today’s lecture:
Agenda
– Computer system consists of
• CPU
• Device controllers
• Common bus
• Shared memory
– CPU and device controllers execute concurrently.
– Memory controller synchronizes access to memory.
Computer System Operation
– Each device controller is in charge of a particular device type
– Each device controller has a local buffer
– CPU moves data from/to main memory to/from local buffers
– I/O is from the device to local buffer of controller
– Device controller informs CPU that it has finished its operation
by causing an interrupt
Computer System Operation
– An interrupt is a signal sent to the CPU
– Interrupt transfers control to the interrupt service routine
generally, through the interrupt vector, which contains the
addresses of all the service routines.
– Interrupt types:
• Hardware Interrupts (polling/vectored)
• Software Interrupts: system calls (trap/exception)
Interrupts
– A trap is a software generated interrupt caused by:
• Error: division by zero or invalid memory access
• Request: from a user program to O/S
– An operating system is interrupt driven.
Interrupts (Cont.)
1) CPU is interrupted
2) CPU stops current process
3) CPU transfers execution to a fixed location ‘registers + Program Counter’
4) CPU executes interrupt service routine
5) CPU resumes process
– Notes:
• Interrupts must be handled quickly
• Interrupted process information must be stored
Interrupt Handling
1) Power up
2) Initial program: bootstrap (firmware)
– Stored in ROM or EPROM
– Initialize:
1) CPU registers
2) Device controllers
3) Memory contents
4) Load the operating system (kernel)
3) Kernel starts the first process – init
4) Init waits for an event (interrupt) to occur
Computer System Startup
Power-On Self-Test
BIOS: basic input/output system
– Controllers:
• Are in charge of a specific type of device
• Moves data between device and local buffer
• A controller may have more than one device
• Buffer size varies
– Two types (Synchronous + Asynchronous):
• Type 1: After I/O starts, control returns to user program only upon I/O
completion.
• Type 2: After I/O starts, control returns to user program without waiting
for I/O completion.
I/O Structure
– Used for high-speed I/O devices able to transmit information at
close to memory speeds.
– Device controller transfers blocks of data from buffer storage
directly to main memory without CPU intervention.
– Only one interrupt is generated per block, rather than the one
interrupt per byte.
Direct Memory Access (DMA) Structure
Old Structure: I/O → CPU → Memory
Modern Structure: I/O → Memory
Direct Memory Access (DMA) Structure
A von Neumann architecture
Modern
Computer
– The basic unit of computer storage is the bit.
– Computer Storage:
• A byte is 8 bits
• A kilobyte (KB) is 1,0241 (210) bytes
• A megabyte (MB) is 1,0242 (220) bytes
• A gigabyte (GB) is 1,0243 (230) bytes
• A terabyte (TB) is 1,0244 (240) bytes
• A petabyte (PB) is 1,0245 (250) bytes
– Given enough bits a computer can represent:
• numbers, letters, images, sounds, documents … etc.
Storage Definitions and Notation Review
01000001
Character ‘A’
Storage Definitions and Notation Review (Cont.)
Memory Unit Description
Bit 0 or 1
Byte 8 bits
KiloByte (KB) 1024 Bytes
MegaByte (MB) 1024 KB
GigaByte (GB) 1024 MB
TeraByte (TB) 1024 GB
PetaByte (PB) 1024 TB
HexaByte or exaByte (EB) 1024 PB
ZettaByte (ZB) 1024 EB
YottaByte (YB) 1024 ZB
BrontoByte 1024 YB
GeopByte 1024 Bronto Bytes
00000000000000000000000000000000000000011111111111111111111111111111111100000111111111111100000000000
00
00000000000000000000000000000000000000011111111111111111111111111101110000000000111111111000000000000
00
00000000000000000000000000000000000000011111111111111111111111111111111000000000001111111000000000000
00
00000000000000000000000000000000000000111111111111111111111111111111110000000000001111111000000000000
00
00000000000000000000000000000000000000111111111111111111111111111111000000000000001111111000000000000
00
00000000000000000000000000000000000000111111111111111111111111111111110000000000001111111000000000000
00
00000000000000000000000000000000000000111111111111111111111111111111111111110000001111110000000000000
00
00000000000000000000000000000000000000111111111111111111111111110111111111111110000111100000000000000
00
00000000000000000000000000000000000000011111111111111111111111110001111111111111000111100000000000000
00
00000000000000000000000000000000000000011111111111111111111111110000111111111100000111000000000000000
00
00000000000000000000000000000000000011111000011111111111111111100000000000000000000111000000000000000
00
00000000000000000000000000000000000011111000111111111111111111100000000000000000000000100000000000000
00
00000000000000000000000000000000000011111111111111111111111111111100000000000000000000010000000000000
00
00000000000000000000000000000000000001111111111111111111111111111110000000000000000110000000000000000
– Punched Card
• Early method of data storage used with early computers
• Containing several punched holes that represents data
Early Data Storage
– Main memory - RAM (volatile)
• Only large storage media that the CPU can access directly.
– Secondary storage (non-volatile)
• Extension of main memory that provides large nonvolatile storage capacity.
– Tertiary Storage
Storage Structure (Cont.)
– Array of memory words
– Each byte has an address
– Memory Address:
• Physical
• Logical
– CPU Instructions:
• Load: moves a word from main memory to CPU register
• Store: move a word from CPU register to main memory
Random Access Memory (RAM)
– 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.
Magnetic Disk (Hard Disk Drive – HDD)
First Hard Disk Drive (HDD)
• IBM RAMDAC computer – 1956
• Solid-state drives (SSD) now
– Early secondary storage
– Slow access time
– Usage
• Backup
• Storage of infrequently used information
– Examples:
• Magnetic tape
• Optical disc
• Optical tapes
Tertiary Storage
– 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 is smaller than storage being cached
– Cache depends on locality (nearest storage to access).
– Multitasking environments depends on caching!
Caching concept
Storage-Device Hierarchy
bytes
MBs
MBs - GBs
GBs - TBs
GBs - TBs
GBs - TBs
GBs - TBs
Performance of Various Levels of Storage
– Mode bit provided by hardware to indicate the current mode
• User mode (bit 0)
• kernel mode (bit 1)
– Provides ability to distinguish when system is running:
• user code (Application Program - 0)
• kernel code (System Program - 1)
Hardware Dual-Mode
– Some instructions designated as privileged, and are only executable
in kernel mode
– System call changes mode to kernel, and the return from call resets
it to user
Hardware Dual-Mode (Cont.)
– All I/O instructions are privileged
– I/O device registers are inaccessible by user
– Users cannot issue I/O instructions directly
– Users must do it through the OS
1) I/O Protection
– Must provide memory protection at least for the interrupt
vector and the interrupt service routines.
– In order to have memory protection:
• add two registers that determine the range of legal addresses a
program may access
✓ Base Register: holds the smallest legal physical memory address.
✓ Limit Register: contains the size of the range.
• Memory outside the defined range is protected.
2) Memory Protection
2) Memory Protection (Cont.)
OS
2) Memory Protection (Cont.)
3) CPU Protection (Cont.)
– Timers
• interrupts CPU after specified period
– Timer is decremented every clock tick
– Use of timers
• Time sharing systems
✓ Interrupt every N milliseconds
✓ Switch control to other processes
• Computing current time
File type Extension Function
executable .exe ready to run program
source code .c .cpp .py .java … etc. source code in various languages
Batch .bat .sh Commands to the CMD
Text .txt .doc .docx .pdf .ppt .pptx textual data and documents
Images .png .jpg .jpeg .svg .webp .gif .heic Viewing format
Audio .mp3 .mp4 .wav .ogg .webm songs and other audio related
Archive .zip .rar compressed files
FileTypes – Name, Extension
Directory Structure
• A collection of nodes containing information about all files
F 1 F 2
F 3
F 4
F n
Directory / Folder
Files
Both the directory structure and the files reside on disk
A Typical File-system Organization
• Windows File System:
✓ NTFS (New Technology File System)
• Linux File System:
✓ ext4 (Fourth Extended File System)
• macOS File System:
✓ APFS (Apple File System)
• Others:
✓ FAT32 (File Allocation Table)
✓ exFAT (Extended File Allocation Table)
Protection Issue: read, write, execute, append, delete … etc.
directory
files
directory
files
directory
files
disk
1
disk
2
Partition
D
Partition
C
Partition
E
A Typical File-system Organization
Types of viruses
Types of viruses (Cont.)
Type Function
Worms a computer program that replicates itself.
Trojan Horse a sort of destructive program that remains disguised in a normal software
program.
Ransomware designed to encrypt your files and block access to them until a ransom is paid.
Adware an unwanted software that displays advertisements on your screen.
Spyware invades your computer and attempts to steal your personal information such
as credit card or banking information, web accounts.
How to protect yourself ?
– Antivirus
• is a program that secures your system from any potential
viruses.
– Firewall
• is a protective shield that keeps bad things away from
your computer.
Operating System Services
– Almost all operating systems have a user interface (UI)
• Command-Line (CLI)
• Graphics User Interface (GUI)
• Batch
1) User Interface
Types of User Interface (UI)
- Provide a programming interface to the services provided by the OS.
- Generally available as assembly-language instructions.
– Typically written in a high-level language (C or C++)
- Mostly accessed by programs via a high-level Application Programming
Interface (API) rather than direct system call use
2) System Calls
System Call Position
User-mode
User-mode
Kernel-mode
System Call Interface (API)
Hierarchy Summary
Library Function
System Call Interface (API)
System Call
- Copy Program Example:
• open (file 1)
• create (file 2)
• read(file 1)
• write (file 2)
• close (file 1)
• close (file 2)
System Call Example
file 1 file 2
– Process Control
– File Management
– Device Management
– Information Maintenance
– Communications
– Protection
Types of Systems Calls
– create process, terminate process
– end, abort
– load, execute
– get process attributes, set process attributes
– wait for time
– wait event, signal event
– allocate & free memory
1) Process Control System Calls
– create file, delete file
– open, close file
– read, write, reposition
– get file attributes, set file attributes
2) File Management System Calls
– request device, release device
– read, write
– get device attributes, set device attributes
– logically attach or detach devices
3) Device Management System Calls
– get time or date, set time or date
– get process, file, or device data/attributes
– Set process, file, or device data/attributes
– get system data, set system data
4) Information Maintenance System Calls
– create, delete communication connection
– send, receive messages
– transfer status information
– attach or detach remote devices
5) Communications System Calls
Communication Models
(a) Shared Memory. (b) Message Passing.
– Control access to resources
– Get and set permissions
– Allow and deny user access
6) Protection
System CallsTypes – Summary
Binary Logic – Definition
– Binary logic consists of binary variables and a set of logical
operations.
– Each variable having two and only two distinct possible values: 1
and 0.
– Three Basic logical operations: AND, OR, and NOT.
1 0
Binary Logic – Definition
– Binary logic consists of binary variables and a set of logical
operations.
Logic
Gates
Basic Gates
AND
OR
NOT
Derived
Gates
NOR
NAND
XOR
XNOR
How does they look ?
AND Logic Gate
Inputs Output
x y F = x • y
0 0 0
0 1 0
1 0 0
1 1 1
x
y
F
AND Gate
x AND y is equal to F
F = x • y
F = xy
OR Logic Gate
Inputs Output
x y F = x + y
0 0 0
0 1 1
1 0 1
1 1 1
OR Gate
x OR y is equal to F
F = x + y
x
y
F
NOT/Inverter Logic Gate
Inputs Output
A F
0 1
1 0
X F
NOT Gate
F = X’
F = X
NAND Logic Gate
Inputs Output
x y F = (x • y)
0 0 1
0 1 1
1 0 1
1 1 0
NAND Gate
x NAND y is equal to F
F = (x • y)
x
y
F
NOR Logic Gate
Inputs Output
x y F = (x + y)
0 0 1
0 1 0
1 0 0
1 1 0
NOR Gate
x NOR y is equal to F
F = (x + y)
x
y
F
XOR Logic Gate
Inputs Output
x y F = x ⊕ y
0 0 0
0 1 1
1 0 1
1 1 0
XOR Gate
x XOR y is equal to F
F = x ⊕ y
x
y
F
XNOR Logic Gate
Inputs Output
x y F = (x ⊕ y)
0 0 1
0 1 0
1 0 0
1 1 1
XNOR Gate
x XNOR y is equal to F
F = (x ⊕ y)
x
y
F
Examples
a) Four-input OR gate
b) Three-input OR gate
c) Mixture of both
Distributive Laws
x y z y + z x • (y + z) x • y x • z (x • y) + (x • z)
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
Distributive Laws (Cont.)
x y z y + z x • (y + z) x • y x • z (x • y) + (x • z)
0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0
0 1 0 1 0 0 0 0
0 1 1 1 0 0 0 0
1 0 0 0 0 0 0 0
1 0 1 1 1 0 1 1
1 1 0 1 1 1 0 1
1 1 1 1 1 1 1 1
Another Example
x y x' y' x + y (x + y)’ x'y’ x y x' + y’ (xy)’
0 0
0 1
1 0
1 1
Another Example (Cont.)
x y x' y' x + y (x + y)’ x'y’ xy x' + y’ (xy)’
0 0 1 1 0 1 1 0 1 1
0 1 1 0 1 0 0 0 1 1
1 0 0 1 1 0 0 0 1 1
1 1 0 0 1 0 0 1 0 0
Conversions
x
y
x
y
x
F
Conversions (Cont.)
x
y
x
y
x
F
F = xy + x(x + y)
Conversions (Cont.)
x'
y
z'
x'
y'
z
F
F = x (y' + z) (x' + y + z')
Conversions (Cont.)
x'
y
z'
x'
y'
z
F
– To find the one’s complement you simply invert the binary number.
Example:
• The one’s complement of the binary number 10001000 is 01110111
One’s Complement
– What’s DMA (Direct Memory Access)?
– What’re the main computer system components?
– Mention three types of storage structure along with their
advantages.
– What’re the three main logic gates found?
Test your knowledge ?
End of lecture 2
ThankYou!

Introduction to Operating System - Lecture 2

  • 1.
    By Mohamed Gamal Lecture2: Computer System Structure Operating System
  • 2.
    – What’s anOperating System (OS)? – What’re the three well-known OSes existing today? – What’re the main basic operations of the computer? – What’re the main computer system components? Test your knowledge ?
  • 3.
    – What’s thedifference between multiprocessing and multiprogramming? – What’s the difference between Application Programs and System Programs? – What’s the difference between LAN and WAN? – Explain Grid Systems concept and its derivatives. – CMD Revision. Test your knowledge ?
  • 4.
    The topics oftoday’s lecture: Agenda
  • 6.
    – Computer systemconsists of • CPU • Device controllers • Common bus • Shared memory – CPU and device controllers execute concurrently. – Memory controller synchronizes access to memory. Computer System Operation
  • 7.
    – Each devicecontroller is in charge of a particular device type – Each device controller has a local buffer – CPU moves data from/to main memory to/from local buffers – I/O is from the device to local buffer of controller – Device controller informs CPU that it has finished its operation by causing an interrupt Computer System Operation
  • 8.
    – An interruptis a signal sent to the CPU – Interrupt transfers control to the interrupt service routine generally, through the interrupt vector, which contains the addresses of all the service routines. – Interrupt types: • Hardware Interrupts (polling/vectored) • Software Interrupts: system calls (trap/exception) Interrupts
  • 9.
    – A trapis a software generated interrupt caused by: • Error: division by zero or invalid memory access • Request: from a user program to O/S – An operating system is interrupt driven. Interrupts (Cont.)
  • 10.
    1) CPU isinterrupted 2) CPU stops current process 3) CPU transfers execution to a fixed location ‘registers + Program Counter’ 4) CPU executes interrupt service routine 5) CPU resumes process – Notes: • Interrupts must be handled quickly • Interrupted process information must be stored Interrupt Handling
  • 11.
    1) Power up 2)Initial program: bootstrap (firmware) – Stored in ROM or EPROM – Initialize: 1) CPU registers 2) Device controllers 3) Memory contents 4) Load the operating system (kernel) 3) Kernel starts the first process – init 4) Init waits for an event (interrupt) to occur Computer System Startup Power-On Self-Test BIOS: basic input/output system
  • 13.
    – Controllers: • Arein charge of a specific type of device • Moves data between device and local buffer • A controller may have more than one device • Buffer size varies – Two types (Synchronous + Asynchronous): • Type 1: After I/O starts, control returns to user program only upon I/O completion. • Type 2: After I/O starts, control returns to user program without waiting for I/O completion. I/O Structure
  • 14.
    – Used forhigh-speed I/O devices able to transmit information at close to memory speeds. – Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention. – Only one interrupt is generated per block, rather than the one interrupt per byte. Direct Memory Access (DMA) Structure Old Structure: I/O → CPU → Memory Modern Structure: I/O → Memory
  • 15.
    Direct Memory Access(DMA) Structure A von Neumann architecture Modern Computer
  • 17.
    – The basicunit of computer storage is the bit. – Computer Storage: • A byte is 8 bits • A kilobyte (KB) is 1,0241 (210) bytes • A megabyte (MB) is 1,0242 (220) bytes • A gigabyte (GB) is 1,0243 (230) bytes • A terabyte (TB) is 1,0244 (240) bytes • A petabyte (PB) is 1,0245 (250) bytes – Given enough bits a computer can represent: • numbers, letters, images, sounds, documents … etc. Storage Definitions and Notation Review 01000001 Character ‘A’
  • 18.
    Storage Definitions andNotation Review (Cont.) Memory Unit Description Bit 0 or 1 Byte 8 bits KiloByte (KB) 1024 Bytes MegaByte (MB) 1024 KB GigaByte (GB) 1024 MB TeraByte (TB) 1024 GB PetaByte (PB) 1024 TB HexaByte or exaByte (EB) 1024 PB ZettaByte (ZB) 1024 EB YottaByte (YB) 1024 ZB BrontoByte 1024 YB GeopByte 1024 Bronto Bytes
  • 19.
    00000000000000000000000000000000000000011111111111111111111111111111111100000111111111111100000000000 00 00000000000000000000000000000000000000011111111111111111111111111101110000000000111111111000000000000 00 00000000000000000000000000000000000000011111111111111111111111111111111000000000001111111000000000000 00 00000000000000000000000000000000000000111111111111111111111111111111110000000000001111111000000000000 00 00000000000000000000000000000000000000111111111111111111111111111111000000000000001111111000000000000 00 00000000000000000000000000000000000000111111111111111111111111111111110000000000001111111000000000000 00 00000000000000000000000000000000000000111111111111111111111111111111111111110000001111110000000000000 00 00000000000000000000000000000000000000111111111111111111111111110111111111111110000111100000000000000 00 00000000000000000000000000000000000000011111111111111111111111110001111111111111000111100000000000000 00 00000000000000000000000000000000000000011111111111111111111111110000111111111100000111000000000000000 00 00000000000000000000000000000000000011111000011111111111111111100000000000000000000111000000000000000 00 00000000000000000000000000000000000011111000111111111111111111100000000000000000000000100000000000000 00 00000000000000000000000000000000000011111111111111111111111111111100000000000000000000010000000000000 00 00000000000000000000000000000000000001111111111111111111111111111110000000000000000110000000000000000
  • 20.
    – Punched Card •Early method of data storage used with early computers • Containing several punched holes that represents data Early Data Storage
  • 21.
    – Main memory- RAM (volatile) • Only large storage media that the CPU can access directly. – Secondary storage (non-volatile) • Extension of main memory that provides large nonvolatile storage capacity. – Tertiary Storage Storage Structure (Cont.)
  • 22.
    – Array ofmemory words – Each byte has an address – Memory Address: • Physical • Logical – CPU Instructions: • Load: moves a word from main memory to CPU register • Store: move a word from CPU register to main memory Random Access Memory (RAM)
  • 23.
    – Rigid metalor 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. Magnetic Disk (Hard Disk Drive – HDD)
  • 24.
    First Hard DiskDrive (HDD) • IBM RAMDAC computer – 1956 • Solid-state drives (SSD) now
  • 25.
    – Early secondarystorage – Slow access time – Usage • Backup • Storage of infrequently used information – Examples: • Magnetic tape • Optical disc • Optical tapes Tertiary Storage
  • 26.
    – Information inuse 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 is smaller than storage being cached – Cache depends on locality (nearest storage to access). – Multitasking environments depends on caching! Caching concept
  • 27.
    Storage-Device Hierarchy bytes MBs MBs -GBs GBs - TBs GBs - TBs GBs - TBs GBs - TBs
  • 28.
    Performance of VariousLevels of Storage
  • 30.
    – Mode bitprovided by hardware to indicate the current mode • User mode (bit 0) • kernel mode (bit 1) – Provides ability to distinguish when system is running: • user code (Application Program - 0) • kernel code (System Program - 1) Hardware Dual-Mode
  • 31.
    – Some instructionsdesignated as privileged, and are only executable in kernel mode – System call changes mode to kernel, and the return from call resets it to user Hardware Dual-Mode (Cont.)
  • 33.
    – All I/Oinstructions are privileged – I/O device registers are inaccessible by user – Users cannot issue I/O instructions directly – Users must do it through the OS 1) I/O Protection
  • 34.
    – Must providememory protection at least for the interrupt vector and the interrupt service routines. – In order to have memory protection: • add two registers that determine the range of legal addresses a program may access ✓ Base Register: holds the smallest legal physical memory address. ✓ Limit Register: contains the size of the range. • Memory outside the defined range is protected. 2) Memory Protection
  • 35.
  • 36.
  • 37.
    3) CPU Protection(Cont.) – Timers • interrupts CPU after specified period – Timer is decremented every clock tick – Use of timers • Time sharing systems ✓ Interrupt every N milliseconds ✓ Switch control to other processes • Computing current time
  • 38.
    File type ExtensionFunction executable .exe ready to run program source code .c .cpp .py .java … etc. source code in various languages Batch .bat .sh Commands to the CMD Text .txt .doc .docx .pdf .ppt .pptx textual data and documents Images .png .jpg .jpeg .svg .webp .gif .heic Viewing format Audio .mp3 .mp4 .wav .ogg .webm songs and other audio related Archive .zip .rar compressed files FileTypes – Name, Extension
  • 39.
    Directory Structure • Acollection of nodes containing information about all files F 1 F 2 F 3 F 4 F n Directory / Folder Files Both the directory structure and the files reside on disk
  • 40.
    A Typical File-systemOrganization • Windows File System: ✓ NTFS (New Technology File System) • Linux File System: ✓ ext4 (Fourth Extended File System) • macOS File System: ✓ APFS (Apple File System) • Others: ✓ FAT32 (File Allocation Table) ✓ exFAT (Extended File Allocation Table) Protection Issue: read, write, execute, append, delete … etc. directory files directory files directory files disk 1 disk 2 Partition D Partition C Partition E
  • 41.
  • 43.
  • 44.
    Types of viruses(Cont.) Type Function Worms a computer program that replicates itself. Trojan Horse a sort of destructive program that remains disguised in a normal software program. Ransomware designed to encrypt your files and block access to them until a ransom is paid. Adware an unwanted software that displays advertisements on your screen. Spyware invades your computer and attempts to steal your personal information such as credit card or banking information, web accounts.
  • 45.
    How to protectyourself ? – Antivirus • is a program that secures your system from any potential viruses. – Firewall • is a protective shield that keeps bad things away from your computer.
  • 47.
  • 48.
    – Almost alloperating systems have a user interface (UI) • Command-Line (CLI) • Graphics User Interface (GUI) • Batch 1) User Interface
  • 49.
    Types of UserInterface (UI)
  • 50.
    - Provide aprogramming interface to the services provided by the OS. - Generally available as assembly-language instructions. – Typically written in a high-level language (C or C++) - Mostly accessed by programs via a high-level Application Programming Interface (API) rather than direct system call use 2) System Calls
  • 51.
  • 52.
  • 53.
    Hierarchy Summary Library Function SystemCall Interface (API) System Call
  • 54.
    - Copy ProgramExample: • open (file 1) • create (file 2) • read(file 1) • write (file 2) • close (file 1) • close (file 2) System Call Example file 1 file 2
  • 55.
    – Process Control –File Management – Device Management – Information Maintenance – Communications – Protection Types of Systems Calls
  • 56.
    – create process,terminate process – end, abort – load, execute – get process attributes, set process attributes – wait for time – wait event, signal event – allocate & free memory 1) Process Control System Calls
  • 57.
    – create file,delete file – open, close file – read, write, reposition – get file attributes, set file attributes 2) File Management System Calls
  • 58.
    – request device,release device – read, write – get device attributes, set device attributes – logically attach or detach devices 3) Device Management System Calls
  • 59.
    – get timeor date, set time or date – get process, file, or device data/attributes – Set process, file, or device data/attributes – get system data, set system data 4) Information Maintenance System Calls
  • 60.
    – create, deletecommunication connection – send, receive messages – transfer status information – attach or detach remote devices 5) Communications System Calls
  • 61.
    Communication Models (a) SharedMemory. (b) Message Passing.
  • 62.
    – Control accessto resources – Get and set permissions – Allow and deny user access 6) Protection
  • 63.
  • 65.
    Binary Logic –Definition – Binary logic consists of binary variables and a set of logical operations. – Each variable having two and only two distinct possible values: 1 and 0. – Three Basic logical operations: AND, OR, and NOT. 1 0
  • 66.
    Binary Logic –Definition – Binary logic consists of binary variables and a set of logical operations. Logic Gates Basic Gates AND OR NOT Derived Gates NOR NAND XOR XNOR
  • 67.
  • 68.
    AND Logic Gate InputsOutput x y F = x • y 0 0 0 0 1 0 1 0 0 1 1 1 x y F AND Gate x AND y is equal to F F = x • y F = xy
  • 69.
    OR Logic Gate InputsOutput x y F = x + y 0 0 0 0 1 1 1 0 1 1 1 1 OR Gate x OR y is equal to F F = x + y x y F
  • 70.
    NOT/Inverter Logic Gate InputsOutput A F 0 1 1 0 X F NOT Gate F = X’ F = X
  • 71.
    NAND Logic Gate InputsOutput x y F = (x • y) 0 0 1 0 1 1 1 0 1 1 1 0 NAND Gate x NAND y is equal to F F = (x • y) x y F
  • 72.
    NOR Logic Gate InputsOutput x y F = (x + y) 0 0 1 0 1 0 1 0 0 1 1 0 NOR Gate x NOR y is equal to F F = (x + y) x y F
  • 73.
    XOR Logic Gate InputsOutput x y F = x ⊕ y 0 0 0 0 1 1 1 0 1 1 1 0 XOR Gate x XOR y is equal to F F = x ⊕ y x y F
  • 74.
    XNOR Logic Gate InputsOutput x y F = (x ⊕ y) 0 0 1 0 1 0 1 0 0 1 1 1 XNOR Gate x XNOR y is equal to F F = (x ⊕ y) x y F
  • 75.
    Examples a) Four-input ORgate b) Three-input OR gate c) Mixture of both
  • 76.
    Distributive Laws x yz y + z x • (y + z) x • y x • z (x • y) + (x • z) 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1
  • 77.
    Distributive Laws (Cont.) xy z y + z x • (y + z) x • y x • z (x • y) + (x • z) 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1
  • 78.
    Another Example x yx' y' x + y (x + y)’ x'y’ x y x' + y’ (xy)’ 0 0 0 1 1 0 1 1
  • 79.
    Another Example (Cont.) xy x' y' x + y (x + y)’ x'y’ xy x' + y’ (xy)’ 0 0 1 1 0 1 1 0 1 1 0 1 1 0 1 0 0 0 1 1 1 0 0 1 1 0 0 0 1 1 1 1 0 0 1 0 0 1 0 0
  • 80.
  • 81.
  • 82.
  • 83.
    F = x(y' + z) (x' + y + z') Conversions (Cont.) x' y z' x' y' z F
  • 85.
    – To findthe one’s complement you simply invert the binary number. Example: • The one’s complement of the binary number 10001000 is 01110111 One’s Complement
  • 86.
    – What’s DMA(Direct Memory Access)? – What’re the main computer system components? – Mention three types of storage structure along with their advantages. – What’re the three main logic gates found? Test your knowledge ?
  • 87.
    End of lecture2 ThankYou!