CS2005 Networks and Operating Systems
Authors: A. Silberschatz, P. Baer Galvin, G. Gagne
©2003
Welcome to the OS part of CS2005
Semester: 2
Week 18: Operating Systems Structures and Processes (HTTP)
Week 19: Threads (HTTP)
Week 20: Process Synchronization (Concurrency)
Week 21: Security (Concurrency)
Week 22: No Lecture (Exam Brief, TCP/UDP)
Week 23: Effective Learning Week
Weeks 24-25: No Lectures
Week 28: Revision Lecture (No Lectures/Labs, TCP/UDP, ICMP)
Describe the services an operating system provides to users, processes, and other systems.
Understand:
The meaning of a Process in an operating systems context.
The composition of a process and its scheduling in an operating system.
What are the key services of an operating system?
What are the main approaches to access operating system services?
What are system calls and system programs?
What is a Process?
How does a Process get composed?
What are the possible states of a Process?
How is a Process scheduled in an operating system?
Resource links for operating systems:
Examples: ios, TinyOS, TIZEN
Provides an environment for program execution.
Offers services that differ among operating systems but have common classes.
User Interface (UI):
CLI (Command Line Interface), Batch Interface, GUI (Graphical User Interface).
Program Execution:
Load and run programs, normal or abnormal termination.
I/O Operations:
Indirect control of I/O devices.
File-system Manipulation:
Manage reading, writing, creating, deleting files/directories, and manage permissions.
Communications:
Information exchange between processes, possibly on different systems.
Implementations: shared memory, message passing.
Error Detection:
Continuous monitoring for hardware and software errors; may lead to system halting or process termination.
Resource Allocation:
Manage resource allocation among multiple users/jobs.
Accounting:
Track resource usage by users.
Protection and Security:
Control access to information and ensure system security from unauthorized access.
CLI allows direct command entry, sometimes implemented in the kernel or via higher-level system programs.
Fetches and executes commands, often with batch processing.
Examples: Windows cmd.exe, Unix/Linux shells (Bourne shell, C shell, BASH).
Batch files run collections of CLI commands for various tasks.
Resources:
Network diagnostics examples: How to Write a Batch Script.
User-friendly interface utilizing desktop metaphors; often includes mouse and keyboard interaction.
Examples: Microsoft Windows GUI; Apple Mac OS GUI with UNIX kernel; Unix/Linux with optional GUI.
Systems must load and run programs, managing the execution process.
Typically use high-level languages to access OS services via APIs.
Each system call associated with a number; the interface invokes it via a kernel call and returns results.
Programmer follows the API without needing to know implementation details.
Flow: User application -> System call interface -> Kernel Mode implementation.
Simple program example using standard library for output.
Process Control: CreateProcess() (Windows) vs. fork() (Unix).
File Management: CreateFile() vs open().
Device Manipulation: SetConsoleMode() vs ioctl().
Process control: create, terminate, load, execute processes.
File management: create, delete, open, close files.
Device management: request/release devices, I/O operations.
Information maintenance: get/set system data.
Communications: create/delete connections, send/receive messages.
Known as system utilities, providing a programming environment.
Can act as user interfaces to system calls or more complex services like device drivers.
File management: create, delete, or manipulate files.
Status information: retrieve system stats like memory or disk space.
File modification: text editing and transformations.
Programming-language support: compilers, assemblers, debuggers.
Program loading/execution: loaders, linkers, debuggers.
Communications: mechanism for virtual connections and information exchange.
A process is an executing program needing resources like CPU time and memory.
Acts as the unit of work within systems comprising both user and OS processes.
A process is created, scheduled, and maintained with various resource allocations.
OS roles: creation, deletion, scheduling, synchronization, communication, and deadlock handling.
Windows: use cmd (tasklist) or task manager.
Unix-like OS: use terminal (ps) or activity monitor.
Definition: A process is a job, task, or user program in execution.
Transitions from executable program to process upon loading.
Text: Program code, current activity, program counter value, CPU registers.
Stack: Temporary data (function parameters, return addresses).
Data: Global variables.
Heap: Dynamically allocated memory during runtime.
States: New, running, waiting, ready, terminated.
Only one process can be running; many can be ready or waiting.
Represents a process in the OS containing various vital information (state, program counter, CPU registers, etc.).
PCBs are updated whenever a process changes state.
Shows process state changes when a process stops running.
The scheduler chooses processes for CPU execution while keeping track of queues: job queue, ready queue, device queue.
Detailed representation of PCB management in different queues including ready and device queues.
Diagrams showing the process life cycle transitions among states (New, Ready, Running, Waiting, Terminated).
Illustrates process transitions through various states during execution.
Short-term Scheduler: Decides next executed process, invoked frequently; must be fast.
Long-term Scheduler: Controls process introduction into ready queue, invoked less frequently; may be slow.