22CS301 OPERATING SYSTEM MODULE 1 -Computer Systems
Session Topic 1.1 Need for Operating Systems -Abstract view of OS 1.2 Computer Systems 1.3 OS Operations 1.4 Virtualization 1.5 Computing Environments 1.6 OS Services 1.7 OS Structures 1.8 System Calls 1.9 Building and Booting OS 1.10 Process 1.11 Threads 1.12 Multithreading Module 1- Introduction MODULE 1 -Computer Systems
1.9 Building and Booting OS MODULE 1 -Computer Systems Course Outcome: Upon completion of the session, students shall have ability to CO1 Identify the basic concepts and operations of operating systems. [ U]
Building and Booting an Operating System Operating systems generally designed to run on a class of systems with variety of peripherals Commonly, operating system already installed on purchased computer But can build and install some other operating systems If generating an operating system from scratch Write the operating system source code Configure the operating system for the system on which it will run Compile the operating system Install the operating system Boot the computer and its new operating system
The operating system is loaded via a bootstrapping procedure, often known as booting. The process of booting involves turning on a computer. The memory of the CPU is empty when it is first turned on . After loading the operating system into the main memory and turning on the computer, it is prepared to accept user commands . The initial collection of tasks the computer carries out when turned on is known as the boot sequence. The kernel is located, loaded into the main memory, and executed by the bootstrap loader. In some systems, the kernel is loaded after a straightforward bootstrap loader retrieves a more intricate boot program from the disk. Restarting a computer is sometimes referred to as rebooting . MODULE 1 -Computer Systems Booting
Step 1: BIOS is loaded Step 2: BIOS: Power on Self-Test This test runs a preliminary examination of the computer's main memory, disk drives, input/output devices, etc. Moreover, the system emits a beep sound in case of any errors. Step 3: Loading of OS The bootable sequence stored in the CMOS is read by BIOS following the successful completion of POST. Step 4: System Configuration Step 5: Loading System Utilities In this step, system utilities like antivirus and volume control are loaded into the memory. Step 6: User Authentication MODULE 1 -Computer Systems Steps of Booting Process in Operating System
Building and Booting Linux Download Linux source code ( http://www.kernel.org ) Configure kernel via “ make menuconfig ” Compile the kernel using “ make ” Produces vmlinuz , the kernel image Compile kernel modules via “ make modules ” Install kernel modules into vmlinuz via “ make modules_install ” Install new kernel on the system via “ make install ”
System Boot When power initialized on system, execution starts at a fixed memory location Operating system must be made available to hardware so hardware can start it Small piece of code – bootstrap loader , BIOS , stored in ROM or EEPROM locates the kernel, loads it into memory, and starts it Sometimes two-step process where boot block at fixed location loaded by ROM code, which loads bootstrap loader from disk Modern systems replace BIOS with Unified Extensible Firmware Interface ( UEFI ) Common bootstrap loader, GRUB , allows selection of kernel from multiple disks, versions, kernel options Kernel loads and system is then running Boot loaders frequently allow various boot states, such as single user mode
Operating-System Debugging Debugging is finding and fixing errors, or bugs Also performance tuning OS generate log files containing error information Failure of an application can generate core dump file capturing memory of the process Operating system failure can generate crash dump file containing kernel memory Beyond crashes, performance tuning can optimize system performance Sometimes using trace listings of activities, recorded for analysis Profiling is periodic sampling of instruction pointer to look for statistical trends Kernighan ’ s Law: “ Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. ”
Performance Tuning Improve performance by removing bottlenecks OS must provide means of computing and displaying measures of system behavior For example, “top” program or Windows Task Manager
Tracing Collects data for a specific event, such as steps involved in a system call invocation Tools include strace – trace system calls invoked by a process gdb – source-level debugger perf – collection of Linux performance tools tcpdump – collects network packets
BCC Debugging interactions between user-level and kernel code nearly impossible without toolset that understands both and an instrument their actions BCC (BPF Compiler Collection) is a rich toolkit providing tracing features for Linux See also the original DTrace For example, disksnoop.py traces disk I/O activity Many other tools (next slide)
Linux bcc/BPF Tracing Tools
try MODULE 1 -Computer Systems The type of booting occurs where the computers hang or reach a state of no response
MODULE 1 -Computer Systems Warm Booting
MODULE 1 -Computer Systems What type of booting “when a computer starts up for the first time or when it is shut down, and the power button is pressed to restart the system”.