IT 3123
Hardware and Software Concepts
Operating Systems II October 26
Copyright © 2005 by Bob Brown Notice: This session is
being recorded.
Multiprogramming
• Two or more application programs in memory.
• Consider one CPU and more than one program. This can be generalized to more than one CPU.
Multiprogramming
• A program may be in one of three states:
• Running: The program’s instructions are being executed by the CPU
• I/O Wait: The program has requested I/O services from the operating system, and the I/O has not completed
• Ready: The program is not waiting for anything, but some other program is using the CPU.
Program Dispatching The operating system keeps three queues:
Running (one program per CPU) Ready
Waiting
Program Dispatching
• Programs in the “running” state are moved to:
Waiting if they request I/O Ready if their time slice expires
• Programs in the “waiting” queue are moved to the “ready” queue when I/O completes
• Programs in the “ready” queue are moved to
“running” when a CPU is available.
Program Dispatching
Running
Ready
Waiting I/O Request
I/O Complete Time Expired CPU Available
Program Dispatching
Running
Ready
Waiting I/O Request
I/O Complete Time Expired CPU Available
OS loads new program Program ends
Priority Scheduling
• Programs can have priority attributes
• The same three queues (running, ready, waiting) are used
• Higher priority programs go to the front of the line. (Or there are several “ready”
queues.)
• Problem: How to prevent a low-priority process from being “starved” of CPU time.
(One way is to increase its priority if it has been waiting a long time.)
Context Switching Context switching: changing what program is running on a CPU
• Save state of running program (registers, program counter)
• Establish state of new program
• Load program counter with starting address.
I/O Bound and CPU Bound
• I/O bound: a program that requires mostly I/O resources; the other processes are not using all the CPU, so the limit on speed is I/O; generally waiting. Give I-O bound programs high priority for the CPU
• CPU bound: a program that requires a lot of CPU time and little I/O; generally ready or running. Give CPU-bound programs lower priority for the CPU.
Operating System Services
• Command processor
• File management system
• I/O control system
• Network management, communication support, and communication interfaces
• System Administration
Operating System Services
• Process control management and inter- process communication
• Memory management
• System protection management
File Management File – a named logical unit of storage Basic file management system provides
• Directory structures for each I/O device
• Tools to copy and move files
• Information about each file in the system and the tools to access that information
• Security mechanisms to protects files and control access
Additional File Facilities
• Backup, emergency retrieval and recovery
• File compression
• Transparent network file access
• Auditing
• Journaling (keeping a separate record of updates)
I/O Services
• Startup configuration
• Device drivers that implement interrupts and provide other techniques for handling I/O
• Optimizes completion of I/O tasks
• Plug and play device recognition
• Hot swapping, hot plugging
Process Control
• A process is an executing program
• A thread is an individually executable part of a process
• Inter-process messaging services
• Example: a pipe in Unix or DOS that is a temporary software connection between two programs or commands
Memory Management
• Identifies programs loaded into memory
• Allocates space to programs
• Recovers space released by programs
• Explicit release
• End of program
• Prevents programs from reading and writing memory outside of their allocated space
Security Management
• Protect OS from users
• Protect users from other users
• Prevent unauthorized entry to system
• Prevent unauthorized system use by
authorized users
Network Services
• Interface between communication software and OS I/O control system that provides network access
• Locate and connect to other computers
• Access files, I/O devices, and programs from remote systems
• Support distributed processing
System Administration
• System configuration and setting group configuration policies
• Adding and deleting users,modifying user privileges
• File system management, backups
• Network administration
• Software installations and upgrades
• OS installations, patches, and upgrades
• System tuning and optimization
Operating System Organization
• Monolithic
• Hierarchical, layered
• Microkernel
Monolithic Kernel
Hierarchical Microkernel
Bootstrapping
• Execution begins with bootstrap loader (mini-loader, IPL) stored in ROM
• Looks for OS program in a fixed location
• Loads OS loader (small) into RAM
• Transfers control to starting location of OS loader
• Loader loads the rest of the OS
• OS loads and executes user programs
User Interface
• Help the user use the computer system productively
• Provide consistent user interface services to application programs to lower learning curves and increase productivity
• Choice of user interface depends on the kind of user:
• Writing programs vs. running applications
• Server computer vs. single-user computer
User Functions
• Program execution
• File commands
• Mount and un-mount devices
• Printer spooling
• Security
• Inter-user communication
• System Status
• Program Services
• DCOM, CORBA, Remote Procedure Call (RPC)
Interface Design
• CLI - Command Line Interface
• Batch System Commands
• Menu-Driven Interfaces
• GUI - Graphical User Interface
• Web Interface
Command Line Interface
• command <operand1> <operand2> …
<switch1> <switch2> …
• Operands
•Positional: must be in a particular order
•Keyword: names and values, or names only; switches
• Advantages
•More flexible and powerful
•Faster for experienced users
•Can combine commands
Command Line Interfaces
Command Languages
• Provide a mechanism to combine sequences of commands together. These pseudo-programs are known as scripts or batch files.
• Startup files: OS configuration, user preferences
• Now often XML encapsulated data
Features of Command Languages
• Can accept input from the user and can output messages to I/O devices
• Provide ability to create and manipulate variables
• Include the ability to branch and loop
• Ability to specify arguments to the program command and to transfer those arguments to variables within the program
MS-DOS Batch File UNIX Shell Script
Menu-Driven Interface
• No need to memorize commands
• All available commands are listed
• Menus can be nested
• Low data requirements
• Slow and painful for experienced users
• Still used in many ATM and point-of-sale systems
Menu Driven Interface
Windows Interfaces
• Also known as Graphical User Interfaces (GUIs)
• WIMP: windows, icons, mice, pointers
• Mouse-driven and icon-based
• Windows
• Are allocated to the use of a particular program or process
• Contain a title bar, menu bar, and widgets
GUI Interface – Windows XP
GUI Interface – Linux KDE GUI Interface - MacIntosh
GUI vs. CLI
GUI
• Advantages
• Easy to learn and use
• Little training
• Amenable to multi- programming
• Disadvantages
• Harder to implement
• More HW/SW requirements
• Requires lots of memory
• SW is complex and difficult to write
CLI
• Advantages
• More flexible and powerful
• Faster for experienced users
• Can combine commands
• Scripting is easy
• Disadvantages
• More difficult to learn and use
• Multiprogramming is awkward
X-Windows
Docucentric Interface
• Focus on the document rather than the application being executed
• Expand role of OS by moving capabilities from the application to system services
• Example: click on document to run program
• Effort to assure that every application program responds in similar ways to user actions.