Basics What does an Operating System do?

- A way to execute programs (user/computer interface) - Allocates resources to programs efficiently and fairly - Manages resources - memory, cpu, devices, system - Schedules jobs - Provides security and protection from others Operating System Basics

Nutt: “... only the most skilled and experienced programmers are allowed to design and modify a computer's operating system.”

Process – a program in execution - has an address space - process table, parent-child relationship

The Shell Operating System Overview

Thread – a unit of work. Multithreading allows a process to be divided into a number of threads so multiple things can be done concurrently.

Deadlocks - Memory Management – memories not big enough -> virtual memory I/O – Programmed, Intr driven, DMA Files, Security and ... File management

OS responsible for managing data on disks (programs, and data). Filesystems – a general way to store files File descriptors – a structure with info about open files File types – several types of files

Big advancement: ZFS

1970 – Bell Labs version 7 – 1978 – ancestor to most modern UNIX systems BSD, SYSV, Linux, (Open)Solaris

UNIX kernel – core of OS system calls – user hooks into kernel library calls – user land routines - eventually end up doing system calls Unix

Daemons – processes running (in the background) usually to perform some service. Example daemons – httpd, smtpd, sshd – clock daemon (start jobs a given in crontab)

File permissions - , - rwx, user, group, other Unix development environment

Editors – , emacs compilers – cc, gcc debuggers – dbx, gdb IDE – sunstudio, eclipse

Trace system calls: truss, Powerful tracing: Dtrace

Homework: run 'truss ls' Booting a Unix System

Boot block boot loader (grub) start kernel start init (usually pid 1) start start-up scripts - flavors: BSD, SYSV, Solaris SMF - usually start services the system provides (many daemons) Start up systems

BSD rc scripts - shell scripts ran during boot - check filesystems and mount - start services and other things - many things in a few scripts

SYSV init.d scripts - Have run levels (S, 0, 1, 2, 3..) - Scripts run when entering a run level - Have one script for each service Solaris SMF

Service Management Facility Introduced in Solaris 10 A big improvement over the past

Services are defined commands: svcs, svcadm, svccfg Knows dependencies has milestones Will restart a daemon that dies XML files and scripts