0% found this document useful (0 votes)
28 views2 pages

Lab Notes 2: Operating System

The document discusses the xv6 operating system, which is a toy OS consisting of 6000 lines of code used to understand concepts in larger kernels. It describes how system calls allow processes to invoke kernel services by alternating between user and kernel space. Key files in xv6 include the kernel, user, header, and tools. Instructions are provided for installing qemu and running xv6 within it by modifying the makefile and running specific make commands. Important system call files and functions are listed, and directions are given for adding a new C function and running it in qemu. A link provides explanations of different xv6 functions.

Uploaded by

abdullah4ejaz-2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views2 pages

Lab Notes 2: Operating System

The document discusses the xv6 operating system, which is a toy OS consisting of 6000 lines of code used to understand concepts in larger kernels. It describes how system calls allow processes to invoke kernel services by alternating between user and kernel space. Key files in xv6 include the kernel, user, header, and tools. Instructions are provided for installing qemu and running xv6 within it by modifying the makefile and running specific make commands. Important system call files and functions are listed, and directions are given for adding a new C function and running it in qemu. A link provides explanations of different xv6 functions.

Uploaded by

abdullah4ejaz-2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Lab Notes 2 Operating System

What is xv6?
The xv6 kernel provides a subset of the services and system calls that Unix kernels traditionally offer. It’s
a toy operating system consisting of about 6000 lines of codes just to provide comprehension of OS. It’s a
good start to understanding of big kernels.

What is a system call?


When a process needs to invoke a kernel service, it invokes a procedure call in the operating system
interface. Such procedures are call system calls. The system call enters the kernel; the kernel performs the
service and returns. Thus a process alternates between executing in user space and kernel space.

Files in xv6:
1. Kernel
2. User
3. Header
4. Tools

Installing qemu:
1. Copy paste xv6 file provided to you in your directory and untar it.
2. Go to terminal and write: sudo apt-get install qemu-system
3. Now open make file of xv6 and do following change. In emulator option write following line:
QEMU:= qemu-system -i386
4. Now enter make all in your terminal. This will make your xv6.
5. Now enter make qemu. This will run qemu on your system.
6. Type ls to confirm qemu is in working state.

Important Files and working of system calls:


1. ./user/usys.S
2. ./user/user.h
3. ./kernel/bootmain.S
4. ./kernel/main.c mainc routine
5. ./kernel/trap.c
6. ./kernel/mmu.h
7. ./kernel/vector.S
8. ./kernel/trapasm.S
9. ./kernel/trap.c
10. ./kernel/syscall.c
11. ./kernel/sysproc.c
12. ./kernel/trapasm.S

Prepared by: Sana


1
Lab Notes 2 Operating System

Now make a new C function and make it by including it in ./user/makefile.mk and run it using qemu.

A useful link for different functions of xv6 is:

https://github.com/YehudaShapira/xv6-explained/blob/master/xv6%20Code%20Explained.md#2252-
userinitvoid

Prepared by: Sana


2

You might also like