E2011: Theoretical fundamentals of computer science Basic concepts about operating systems Vlad Popovici, Ph.D. Fac. of Science - RECETOX Outline 1 Operating systems 2 Kernel 3 Shell Vlad Popovici, Ph.D. (Fac. of Science - RECETOX)E2011: Theoretical fundamentals of computer science Basic concepts about operating syste2 / 20 Physics: electrons Transistors, diodes - devices Analog circuits: amplifiers, filters Logic: adders, memory Digital circuits: gates Microarchitecture: data paths, controllers Architecture: instructions, registers Operating system: device drivers, kernels Application software: programs Abstraction Vlad Popovici, Ph.D. (Fac. of Science - RECETOX)E2011: Theoretical fundamentals of computer science Basic concepts about operating syste3 / 20 Operating systems Why? acts as an interface between user/applications and hardware resource manager: manages I/O and peripherals provide a virtual perspective on the underlying hardware manage programs Vlad Popovici, Ph.D. (Fac. of Science - RECETOX)E2011: Theoretical fundamentals of computer science Basic concepts about operating syste4 / 20 Main roles of the OS: resource sharing: ▶ allocate resources for all activities; separate the resources between activities ▶ isolation of activties ▶ communication between processes/activities virtualization provide standard services: process management, file systems, network services, etc Vlad Popovici, Ph.D. (Fac. of Science - RECETOX)E2011: Theoretical fundamentals of computer science Basic concepts about operating syste5 / 20 OS over time early OS: set of routines for common procedures; single-user OS multi-user OS: → batch processing → multi-tasking → virtual machines time-sharing OS: interactive use modern OS: usually a kernel+GUI; desktop-level (MacOS, Linux, Windows, etc); smart appliances (Android, iOS, Symbian, etc); server-level: GUI is optional (UNIX-based OSes, etc); etc Vlad Popovici, Ph.D. (Fac. of Science - RECETOX)E2011: Theoretical fundamentals of computer science Basic concepts about operating syste6 / 20 Batch OS intially, a system in which jobs are run sequentially a job monitor supervises execution and manages the job queue modern OSes have their own job scheduler(s) allowing for non-interactive, eventually synchronized, execution of jobs Job 1 Job J OS Batch 1 Batch N CPU Vlad Popovici, Ph.D. (Fac. of Science - RECETOX)E2011: Theoretical fundamentals of computer science Basic concepts about operating syste7 / 20 Example of batch OS IBM’s OS/360 developed in the 1960s designed for mainframes goal was to maximize hardware utilization introduces job control language (JCL) Examples: start a job: job name, accounting information, params //MYJOB JOB (ACCOUNT),’MY JOB NAME’,CLASS=A,MSGCLASS=X specify program to execute within job //STEP1 EXEC PGM=MYPROGRAM conditional execution //STEP2 EXEC PGM=ANOTHERPGM,COND=(0,LT,STEP1) Vlad Popovici, Ph.D. (Fac. of Science - RECETOX)E2011: Theoretical fundamentals of computer science Basic concepts about operating syste8 / 20 Multitasking ”concurrent” exectution of processes (tasks) does not imply parallel execution multiprogramming OSes: allow context switching between processes cooperative multitasking: processes voluntarily ceed time to OS/other process: ealry Windows and MacOS preemptive multitasking: OS decides to switch between executing tasks real time systems multi-threaded systems Vlad Popovici, Ph.D. (Fac. of Science - RECETOX)E2011: Theoretical fundamentals of computer science Basic concepts about operating syste9 / 20 Example of multitasking OS UNIX developed in the 1970s at Bell Labs implements preemptive multitasking time-sharing: CPU time dived among multiple processes process management system calls for process control: fork, exec, kill, etc Examples: work with files: ls, cp, mv, rm traverse filesystem hierarchy: cd, pwd control access: chmod, chown control processes: ps, kill Vlad Popovici, Ph.D. (Fac. of Science - RECETOX)E2011: Theoretical fundamentals of computer science Basic concepts about operating syste10 / 20 Another classification of modern OSes 1 Desktop OSes: for personal computers, user-friendly, wide range of applications; ex: Windows, macOS, Linux 2 Mobile OSes: for touch interfaces and mobile devices; ex: Android, iOS, HarmonyOS. 3 Server OSes: manage and optimize network resources, security, and multi-user services; ex: Windows Server, Linux 4 Embedded OSes: for specific hardware and applications; ex: FreeRTOS, Embedded Linux, VxWorks, QNX. 5 Real-Time OSes: when immediate response to inputs is critical; ex: RTLinux, FreeRTOS, QNX, LynxOS. 6 Mainframe OSes: for high-volume processing; ex: IBM z/OS, Unisys OS 2200, HP NonStop OS. 7 Distributed OSes: coordinates multiple computers ex: Apache Hadoop (for data processing clusters), Google’s Kubernetes OS (for container management), Plan 9 from Bell Labs. 8 Network OSes: used for managing networked computers; ex: Novell NetWare, Cisco IOS, Windows Server with Active Directory. Vlad Popovici, Ph.D. (Fac. of Science - RECETOX)E2011: Theoretical fundamentals of computer science Basic concepts about operating syste11 / 20 OS Kernel kernel: the core of the OS that provides services to all other components of OS talks directly to hardware usual start-up sequence: power-on → BIOS (Basic I/O System) → kernel loaded into a protected memory space Vlad Popovici, Ph.D. (Fac. of Science - RECETOX)E2011: Theoretical fundamentals of computer science Basic concepts about operating syste12 / 20 OS Kernel - main functions loading and managing less-critical OS components, such as device drivers managing execution threads and various processes spawned by running applications scheduling applications memory management managing and optimizing hardware resources and dependencies managing and accessing I/O devices (keyboards, mice, disk drives, USB ports, network adapters and display,...) handling device and application system calls using various mechanisms such as hardware interrupts or device drivers Vlad Popovici, Ph.D. (Fac. of Science - RECETOX)E2011: Theoretical fundamentals of computer science Basic concepts about operating syste13 / 20 CPU modes to support kernel: kernel mode: code has unrestricted access to hardware; it is loaded in protected memory space and operates with highest privileges user mode: applications run with lower privileges; access to resources is made via system calls to kernel Vlad Popovici, Ph.D. (Fac. of Science - RECETOX)E2011: Theoretical fundamentals of computer science Basic concepts about operating syste14 / 20 Types of kernels: microkernel: delegates user services and processes in different address space; uses message-passing for communication; more flexibility and security (e.g. QNX - UNIX-based, real-time) monolithic: implements services in the same address space (e.g. most of UNIX-based kernels, Windows 9x) hybrid: tries to combine both (e.g. Windows 10, 11) Vlad Popovici, Ph.D. (Fac. of Science - RECETOX)E2011: Theoretical fundamentals of computer science Basic concepts about operating syste15 / 20 Figure: Comparison of three different kernel types (from Wikipedia) Vlad Popovici, Ph.D. (Fac. of Science - RECETOX)E2011: Theoretical fundamentals of computer science Basic concepts about operating syste16 / 20 Shells a program that allows users and programs to interact with OS services two modes: command line interface (CLI) and graphical user interface (GUI) CLI it has a specific language allowing the on line or scripted interaction with OS examples of CLI: Windows’ Power Shell or UNIX’s bash, tcsh, etc Vlad Popovici, Ph.D. (Fac. of Science - RECETOX)E2011: Theoretical fundamentals of computer science Basic concepts about operating syste17 / 20 Shells Vlad Popovici, Ph.D. (Fac. of Science - RECETOX)E2011: Theoretical fundamentals of computer science Basic concepts about operating syste18 / 20 Questions? Vlad Popovici, Ph.D. (Fac. of Science - RECETOX)E2011: Theoretical fundamentals of computer science Basic concepts about operating syste19 / 20 Explorations go to https://copy.sh/v86/ and instantiate some machines with Windows, DOS, and Linux and try to find your way around alternatively, try https://www.pcjs.org/ for a more diverse selection of OSes (and other older programs) Vlad Popovici, Ph.D. (Fac. of Science - RECETOX)E2011: Theoretical fundamentals of computer science Basic concepts about operating syste20 / 20