Top Banner
26

Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

Dec 13, 2015

Download

Documents

Jean Parker
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.
Page 2: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

Operating System Structure

• A key concept of operating systems is multiprogramming.

– Goal of multiprogramming is to efficiently utilize all of the computing resources.

– When a job issues an I/O request (e.g., open a file, read data from a file), it cannot continue until the request is fulfilled.

– The CPU then becomes idle (the job is blocked on the request).

Page 3: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

Operating System Structure

• Basic idea of multiprogramming: – Keep multiple jobs in memory.– When one job blocks on I/O (or other events), the

operating system:• Starts the I/O operation.• Switches to another job that is ready to execute.• Now the CPU and I/O device are executing in parallel.

– When the I/O device has completed request, it generates an interrupt to inform the CPU.

– Virtually all general purpose computers support multiprogramming.

Page 4: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

• First developed for batch systems in the 60s. – Go to the computer center and give them your program

(stored on punch cards).– The computer operator “batched” several jobs together and

loaded them into the computer. – Come back at 5:00 to get the results of your program.

• Batch systems are non-interactive.

Page 5: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

Time-Sharing Systems (Multitasking)

Logical extension of multiprogramming termed multitasking.

Quite often sitting at terminal using a “command line” interface to interact with computer.

Types in commands from keyboard. A system program called a shell reads

command from the command line and makes OS system calls to carry out commands.

OS switches between user’s programs very quickly, generally in round-robin fashion.

Page 6: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

SharedComputer

User1User 3

User 4

User 2

Page 7: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

SharedComputer User1User 3

User 4

User 2

Page 8: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

SharedComputer User1User 3

User 4

User 2

Page 9: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

SharedComputer User1User 3

User 4

User 2

Page 10: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

SharedComputer User1User 3

User 4

User 2

Page 11: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

Time-Sharing Systems (Multitasking)

Switching between users is very fast. Goal is to give the illusion that each user has own

machine. Think about using a text editor, or getting a

directory listing. Response time is a priority.

Page 12: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

Protection of System Resources

• I/O Devices • Memory • CPU• Files• Operating System

Page 13: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

Protection of System Resources

• Based on dual-mode execution:– kernel mode and user mode.– Privileged instructions can be issued only in kernel mode.– Mode bit in Process Status Word (PSW), checked on every

instruction.

Page 14: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

User process executing System Call

Trap, mode bit = 0 Execute System Call

Return. Mode bit = 1

Continue Execution

Mode

Bit=1

Page 15: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

Protection of I/O Devices

• All I/O instructions are privileged instructions.• Only accessed through system calls.

Page 16: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

Memory Protection

• Must provide memory protection for the interrupt vector, interrupt service routines, and other applications address space.

• 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.

Page 17: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

Use of A Base and Limit Register

Page 18: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

Hardware Address Protection

limit

Page 19: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

CPU (and OS) Protection

• Keep user from monopolizing CPU.• Ensure OS regains control of CPU.

Page 20: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

CPU Protection

• Timer – interrupts computer after specified period to ensure operating system maintains control.– Timer is decremented every clock tick.– When timer reaches the value 0, an interrupt occurs.

• Timer commonly used to implement time sharing.

Page 21: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

Privileged Instructions

• Load base and limit registers?

Page 22: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

Privileged Instructions

• Load base and limit registers?• Set the system timer?

Page 23: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

Privileged Instructions

• Load base and limit registers?• Set the system timer?• Read the system clock?

Page 24: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

Privileged Instructions

• Set the system timer?• Read the system clock?• Load base and limit registers?• Open a file?

Page 25: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

Privileged Instructions

• Load base and limit registers?• Set the system timer?• Read the system clock?• Open a file?• Compile a program and create executable?

Page 26: Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.

Privileged Instructions

• Load base and limit registers?• Set the system timer?• Read the system clock?• Open a file?• Compile a program and create executable?• Enable/disable interrupts?