DOC PREVIEW
UNO CSCI 8530 - System Initialization

This preview shows page 1-2-3 out of 10 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1The Tempo Operating SystemPart 4System InitializationLast Edit: 9/13/2007A Bare MachineA bare machine doesn’t automatically begin executing the operating system and processes when the power switch is pushed.Instead, it must go through “loads” of code before the first user process ever gets a chance to run.The only code available to the CPU on powerup or processor reset is found in various Read-Only Memories (ROMs).2ROMs Found in MachinesMost important ROM contains the BIOS: the Basic I/O System (see next slide).Other ROMs contain code (functions and data structures) that are unique to the I/O devices in the machine (called “option” ROMS):video devices (usually called the video BIOS)network interface cards (NICs), for network bootingdisk adapter code (especially for SCSI devices)BIOS Startup ActionsPOST – power-on self test:Validate the hardware configurationIdentify devices (e.g. serial/parallel/USB ports, disk/CD/DVD drives, PnP devices, etc.), reporting configuration in RAMInvoke initialization code in option ROMsAssign non-conflicting memory and interrupt resources to configurable devices (e.g. those on PCI buses)Allow user configuration of boot sequence, date/time, etc.Search boot devices (in a specified order) for a bootable device.Copy the first sector from the bootable device into memory at 0x7c00 and then transfer control to it.3Additional BIOS FeaturesIn addition to getting the first sector of a bootable device into RAM, a BIOS provides a set of functions for performing simple input/output operations.These usually operate in real mode without external interrupt support, and are intended primarily to help get an operating system into memory. However, more recent BIOS capabilities include some 32-bit (protected mode) services.Only very simple operating systems will continue to use these functions after the operating system is loaded.An Aside on StandardsAs an example of why standards are important, even in the BIOS world, consider the early days of PCs (using the Intel 8080 and the CP/M operating system, without any virtual memory or protection)Most machines had ROM at a fixed location (high memory), and CP/M applications were written to run starting at 0x100.The Radio Shack TRS-80 computer had ROM in low-memory, and so application providers had to make a separate versions for the TRS-80 that avoided the memory occupied by ROM (the 8080 had no hardware facilities for simple relocation of program code and no virtual memory).4The Boot SectorThe boot sector (at least on IA-32) contains 512 bytes, including:a jump instruction to location “x” to skip over the partition tablea partition table (for hard disk partitions) – identifies bootable and non-bootable regions of the boot driveat “x”, code to read from additional disk sectors into memory and then jump to thema “boot signature”, 0xaa55, that allows the BIOS to recognize a valid boot sectorTempo’s Boot SectorSince Tempo wasn’t designed to be booted from a hard disk (perhaps a bad decision that will be changed in the future), the entire boot sector is used for code – there is no partition table.The code (in bootstrap/bsp.s) loads the entire system into memory (starting at physical address 0x8000) and then transfers to it (at start, in realio.s)5Other Bootstrap SequencesOther systems may use a multistage bootstrap process:The boot sector loads a small second-stage bootstrap loader (things like “grub” in the Linux world)The second stage loader then brings in the operating system (perhaps from a compressed image instead of a “flat” image as with Tempo)Once the system is booted, the memory occupied by the bootstrap loader is no longer needed, and can be reused for other purposes.Real Mode Startup (realio.s)Setup the initial stack (grows downward from 0x8000)Setup the TSS (Task State Segment) descriptorSetups values to be used for the GDT (global descriptor table) and IDT (interrupt descriptor table) registersLoads the GDT registerSwitches to protected modeJumps to do_pm (in kernel.s) to finish initialization6Protected Mode Initialization (kernel.s)Set kernel segment registersSet kernel stack pointerZero memory expected to be zero (by C – bss and COMMON)Identify the memory available in the systemClear the display, show system version message, and setup the page map array (which tracks page usage)Initialize the keyboardLoad the IDT registerInitialize the priority interrupt controller(s), masking unused interruptsInitialize the interval timer for 1 msec interruptsTurn on pagingCall “tempo” (in sys.c) – which never returnsTempo (sys.c) – C Code, Finally!We’re still in kernel mode, but we’re running code written in C.“tempo” is responsible for major OS data structure initialization, creating the idle and first user process (which begins execution at Main), and then running the first user process.7OS Data StructuresOS data structures can be allocated in two ways:statically: a fixed-sized pool (array) of typed objects, used as required and returned to the pool when no longer needed.dynamically: available memory pool is untyped; pieces are allocated for objects as needed.There are advantages and disadvantages to each approach.Static Allocation AdvantagesNo memory fragmentationAllocation and deallocation is fastCode is simplerLinear searches can be used to identify a specific object(s) in a pool of objects with the same type8Dynamic Allocation AdvantagesAll available memory can potentially be used; with static allocation, decisions must be made about the number of objects of each type before the system runs, and running out of one type of object can cause system failure, even though there may be unused memory in the pool of objects of a different type.Tempo’s Allocation DesignTempo uses static allocation for the major OS data structures.The size of the structures are defined in the h/sysparm.h fileExamples:#define NPROC 10 /* number of process table entries in proctab */#define NSEMA 20 /* number of semaphores in sematab */#define NMSGS 256 /* number of messages in msgtab */#define NQUEUE 8 /* number of message queues per process */#define NKEYS 128 /* maximum queued keyboard inputs */9OS Initialization (1)Mark all process table entries as unusedAllocate first semaphore for CS macroAllocate second semaphore for keyboardMark other semaphores as unusedCreate pool of message nodesClear the ready queues (one for each priority)If disk I/O is enabled,


View Full Document

UNO CSCI 8530 - System Initialization

Download System Initialization
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view System Initialization and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view System Initialization 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?