Operating Systems Lab 1
-
Upload
medoali5050 -
Category
Documents
-
view
27 -
download
0
description
Transcript of Operating Systems Lab 1
Operating Systems Course
Section 1: Lectures
Text Book: Operating Systems – 7th Edition – William Stallings
What’s OS?!- OS is the master control software that runs other programs. - Its main part, the "kernel," resides in memory at all times. - It’s the interface between the computer devices (H/W) and the user applications (S/W).
OS Main Job:- Is to solve the competition between applications on the computer main resources (CPU,
Memory and Shared Devices).
Operating SystemSolve competition on
CPUCH.9
MemoryCH.7, 8
Shared ResourcesCH.5, 6
Section 2: Labs
In the labs, we will address two out of the three competitions, namely:1- Memory 7 weeks2- Shared Resources 3 weeks
Concerning the competition on memory, we will build our memory management system as a part of real OS to manage the memory using C language under Linux.
For the competition on the resources, we will use the multi-threading and concurrency in the .NET Framework to learn how to handle the competition on any shared resources.
Part I: Memory management (in FOS kernel) Language: C under Linux 7 labs:
Lab 1: Intro. & running empty operating systemLab 2: kernel part 1, navigating kernel source code, extending shell commandsLab 3: kernel part 2, (adding advanced commands)Lab 4: Sheet 1 (CPU scheduling problems) + Introduction to Intel memory segmentation and pagingLab 5: Implementing memory management code part 1EXTRA: Sheet II, III (memory management, and virtual memory problems)Lab 6: Implementing memory management code part 2Lab 7: Implementing memory management code part 3 (Hands on lab)
Output: Memory management project.
Part II: Concurrency and threading (.NET framework 1.1/2.0) Language: Any .NET framework 1.1/2.0 language 3 labs:
Lab 8: Project description, (Producer/Consumer using .NET framework)Lab 9: Barbershop/Airplane problem implementationLab 10: Various problems
Output: Lab Exam
LabsAddress competitions on
Memory7 weeks
Shared Resources3 weeks
Intro & Environment1 week
Kernel code2 weeks
Memory Management Code4 weeks
Intro & Prod/Cons Problem1 week
Barbershop/Airplane Prob.1 week
Various Problems1 weeks
Lab 1“Introduction & Environment”
Introduction
I) Memory Management:
The project for these labs is to construct a real operating system that will boot on a PC. This operating system is simpler than Linux or Windows XP, but it includes some key operating systems abstractions including a boot loader, memory management, and virtual memory.
The project is divided into a series of labs, each of which enhances the functionality of your operating system. Each lab builds on the previous one, so it is important that you design, build, and test carefully at each step. Carelessness in early labs will be costly down the road. There are not a lot of lines of code to write on this project, so take the time to understand each phase before moving to the next one.
We will provide skeleton code, but most you will have to do all the important work.
II) Concurrency and Threading:
You will write multi-threaded applications using .NET framework for problems that deal with concurrency issues like dependency, deadlocks and critical sections using semaphores.
Environments (VMware & Linux)We are developing an operating system!! So, how would we test it?!!
We will use a set of applications called “Virtual Machines” or emulators; these are applications that provide a “Virtual Environment” for us, so that one can define a whole virtual PC (Memory, peripherals (Hard disks, optical drives), CPU, BIOS, floppy etc…) inside the real PC.
We first have the “Bochs emulator ”, in which we will run and test our simple OS FOS.
The OS code (originally taken from UTexas CS372) is written in C language under Linux
So we will install Linux on our machines…
However, this could be an annoying experience to many students, (e.g. no disk space, no free partitions etc…), so what could we do to simplify this…?!!
We will provide the students a CD, which has Linux preinstalled, and will run virtually inside windows XP environment. It will run virtually using a free product called “VMware Player”. See the diagram below:
Hard Disk
Linux Image from CD
Linux
(FOS) Our OS
FCIS OS
Bochs (Emulator)
Windows XP Linux FCIS OS
VMware Player (Virtual Machine)
How to run the virtual Linux image inside your windows XP:1- Install VMware workstation provided on the OS Course CD2- Copy the archive file containing the Linux image named “os_virtual_machine.zip” from
your CD drive to your disk3- Unzip the archive ( “.zip” file)4- Double click the file named “os_virtual_machine.vmx” to start Linux5- When Linux starts, login using this username and password:
Username: osPassword: os
Environment (Bochs & FOS our OS)
Developing an operating system on real hardware can be difficult and time-consuming. Instead we'll be use a freely available PC emulator called Bochs. The operating system you'll develop is in some sense just a toy operating system, but it will be "real" enough to run on actual PC hardware. We're just using Bochs to make development easy.
How to boot Bochs with our operating system FOS:1- Double click the FOS_2008 shortcut on your desktop2- Open the Linux terminal by pressing F4
3- Write the following:> cd part1 ;get into lab1 directory> make ;compile and link the code> bochs ;run Bochs emulator
4- then choose 5 (Begin simulation)
When Bochs first starts, you will see the very first version of our FOS running, you can write:
FOS> kernel_info
This will show you some information about the OS.
Boot loader (revision):Now, we will revise the PC boot process studied previously in assembly language course.The boot process documentationThe boot process slideshow
As it shown previously, 2 main parts are required for loading any OS:1- boot loader: switch from real to protected mode and load the kernel into RAM2- kernel
The kernel is the central component of most computer operating systems. Its responsibilities include managing the system's resources and the communication between hardware and software components.
A kernel provides the lowest-level abstraction layer for the resources (especially memory, processors and I/O devices) that applications must control to perform their function.
Kernel typically makes these facilities available to application processes through inter-process communication mechanisms and system calls.
The Lab Code Structure:
It consists of 2 main parts:1- “boot” folder: containing the assembly code of the boot loader in “boot.s” file
2- “kern” folder: containing the C code of both the shell and the empty kernel
This is it for the first lab, see you soon…
References
MIT OCW OS Course lab 6828
UTexas OS Course lab CS372H (lab1 & lab2).