Interface between User and Hardware - Computer Organization - Homework, Exercises of Computer Architecture and Organization

These HOMEWOR NOTES are very easy to understand and very helpful to built a concept about the foundation of computers ORGANIZATION and Database Design.The key points in these slide are:High-Level Language Programmer’s View, Calculate Powers, Run-Time Stack, Calculates Values, Recursive Function, Number of Call Frames, Caller-Save Register Convention, Procedure Call Standard, Program Counter

Typology: Exercises

2012/2013

Uploaded on 04/27/2013

arundhati
arundhati 🇮🇳

4.5

(23)

88 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
What is an operating system (OS)?
A program that operates as the interface between the user and the hardware
Web
Browser
Accting
package
etc.
Compiler Editors Command Window
Interpreter system
Operating System - file system, memory
manager, etc.
Hardware - CPU, memory, I/O devices
Runs in
User
Mode
Runs in
Kernel
or
Supervisor
Mode
system calls
Goals of OS
1. Make computer convenient to use by providing a virtual/extended machine that is easier to use and program
than the underlying hardware,
CPU
data
addr.
control
data reg
status/ctrl
I/O logic
I/O Controller
data
status
control
Disk
e.g., writing/reading to file on disk
OS provides high-level system calls so programmer does not
need to know details of disk
2. Use computer resources/hardware efficiently
Resources - processor(s), memory, timers, disks, network
Resources are competed for by all running programs
Examples:
- which programs are loaded in limited memory
- restricts access to memory used by other programs and the operating system
- which program can run on the CPU
We can view the OS as resource manager that is responsible for resource allocation, tracking resources,
accounting, and mediating conflicting requests
OS - Page 1
Docsity.com
pf3
pf4

Partial preview of the text

Download Interface between User and Hardware - Computer Organization - Homework and more Exercises Computer Architecture and Organization in PDF only on Docsity!

What is an operating system (OS)?

 A program that operates as the interface between the user and the hardware

Web Browser

Accting package

etc.

Compiler Editors Command Window Interpreter system

Operating System - file system, memory manager, etc.

Hardware - CPU, memory, I/O devices

Runs in User Mode

Runs in Kernel or Supervisor Mode

system calls

Goals of OS

  1. Make computer convenient to use by providing a virtual/extended machine that is easier to use and program than the underlying hardware,

CPU

data

addr.

control

data reg

status/ctrl

I/O logic

I/O Controller

data

status

control

Disk

e.g., writing/reading to file on disk

OS provides high-level system calls so programmer does not need to know details of disk

  1. Use computer resources/hardware efficiently Resources - processor(s), memory, timers, disks, network

Resources are competed for by all running programs

Examples:

  • which programs are loaded in limited memory
  • restricts access to memory used by other programs and the operating system
  • which program can run on the CPU We can view the OS as resource manager that is responsible for resource allocation, tracking resources, accounting, and mediating conflicting requests

OS manages processes (running programs):

A process is the term for a running program. A process’s state consists of the CPU register values, its run-time stack in memory, and it’s other memory content. Many processes maybe executing concurrently, but only one can be executing on a CPU at a time. When the CPU switches to another process, a context switch occurs which involves saving the complete state of the previously executing process before loading the state of the next process to execute into the CPU. Depending on the hardware, this can take up to 100 microseconds (i.e., very slow in computer terms).

Process State Diagram

new

waiting

I/O request or event wait

I/O completion event signaled

Scheduler Dispatched

Interrupt (CPU timer)

Admitted (short-term) Exit ready running terminated

Queues are used to hold process control blocks (PCB) that represent processes internally to the OS.

Process Control Block

Next PCB in queue pointer

Process State

Program Counter Registers

Memory Mgt. Info CPU Scheduling Info.

Accounting Info.

I/O Status Info

CPU Timer - the operating system sets a count-down timer before turning control over to a user program. If the timer expires, it generates an interrupt a user pgm before the user pgm is started. Remember that only one program (in a single CPU system) can be executing at a time so when the OS turns control over to a user program it has “lost control.” Modifications to the CPU timer are privileged

  1. Restrict a user program to its allocated address space in memory. In a simple computer, a user program might be allocated a single continguous address space in memory. The two special purpose CPU registers: StartMemory and EndMemory can bracket the user program's address space. All memory addresses that the user program performs can be checked by hardware in the CPU to make sure that they fall between the values in these registers. If the user program tries to access memory outside the range of addresses indicated by these registers, an interrupt/exception is raised to return control back to the operating system. On more complex computers, a memory-management unit (MMU) provides a more sophicated address mapping scheme (paging, segmentation, paged segments, none). Modifications to the memory-management registers are privileged.

CPU

Memory-Mgt Unit

StartMemory

EndMemory

Memory

Block of Memory Allocated the Current Process

  1. Protection to restrict a process from access files of other programs varies depending on whether the computer is using memory-mapped I/O or instruction-based I/O (see section 4.5 of text). If memory-mapped I/O is being used, the memory address associated with the external device I/O registers are outside of the process accessable memory address space. Thus, our solution (3) above is enough to force a process to request I/O through operating system calls.

If instruction-based I/O instructions array being used. I/O has a separate address space from memory, but we can make these I/O instructions privileged so they can only be executed in system mode. Thus, a process could not execute them directly.