Find Jobs
Hire Freelancers

NachOS operating systems c++

$250-750 USD

Completed
Posted about 9 years ago

$250-750 USD

Paid on delivery
I will attach nachos so you can install in on your machine. Project 3 — System Call and Multitasking 1. Overview In this project, we will learn how to implement system calls and multitasking in Nachos. Two user programs and contiguous memory allocation will be provided. Please download the files from Blackboard, rename them and put them in the corresponding directory (overwriting the original file if there’s one). First, we’ll implement the Write and Exit system calls. Exit system call is trivial. Write system call will be implemented using printf. Note that this is not a complete (or even real) implementation of the Write system call. A true implementation of the Write system call will invoke Nachos console or file system and write to the correct area in the monitor or the Nachos hard disk, respectively. We are just using printf to “fake” the system call. Whenever a user program makes a system call, an exception will be raised, and the kernel will check the type of the exception. If it is a system call, the kernel will execute the corresponding function. Second, we’ll implement multitasking by enabling Round-Robin scheduling. For this we need to introduce the notion of quantum, which is the amount of time slice that the OS allows each process to run on the CPU until it is forced out by the TimerInterruptHandler routine in [login to view URL], after which it will be appended to the end of the ready list. Then the first process in the ready list will run for the next quantum. 2. System call • User programs prog1.c and prog2.c will be provided. These two programs use Write and Exit system calls. Since current Nachos version doesn’t implement these calls, we’ll implement Exit call with the Finish function in Thread class, and fake Write using printf statements in userprog/exception.cc. The codes and signatures of Nachos system calls are defined in userprog/ syscall.h. • As explained in [login to view URL], the system call code and the parameters of a system call are stored in designated CPU registers. Note that the memory addresses passed through in the registers are virtual addresses. This means that you need to perform a virtual to physical address translation when needed. If a value is passed through a register, you can just use the value. You can learn how to do the translation in machine/[login to view URL] and how to read from a memory address in addrspace.cc. - For example, for Write(prompt, 2, output); in test/shell.c, r2 contains the code for Write, which is 7, r4 contains the virtual address of “prompt” buffer, r5 contains value 2, and r6 contains the virtual address of “output” buffer. • For this simplified Write system call, all you need to do is to get the parameters of the call from the registers and the main memory, and print the information using printf in exception.cc. The program counter needs to be advanced before returning from a system call. One instruction is one word, which is 4 bytes, so the value of the program counter should be incremented by 4 because MIPS is a byte-addressable machine. See machine/machine.h to find out the names of CPU registers including the name of the program counter. • After implementing the system calls, you should be able to run a user programs in userprog/ directory with ./nachos -x ../test/prog1 3. Multitasking • In threads/[login to view URL], there is a line that creates a new Timer object when the –rs option is used. This timer object will raise interrupts at random intervals. Now you need to create a timer object that will generate interrupts at every fixed interval. Read the Timer class constructor to understand how to create such an object (machine/timer.[cc|h]). Then implement a -quantum flag, so that you can run Nachos with a chosen quantum (300 ticks for example) using the following command: ./nachos -quantum 300 • Modify the TimerInterruptHandler function (threads/[login to view URL]) so that now context switching to the next thread happens after the current quantum expires
Project ID: 7469540

About the project

2 proposals
Remote project
Active 9 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Hello, sir. I read your job posting with interest. I am very interested in your job. I am a excellent software developer and have rich experiences for 10+ years. I can help you complete your job perfectly in short time. I want to discuss in more details about this job. Looking forward your reply. Thank you.
$500 USD in 10 days
4.9 (6 reviews)
3.8
3.8

About the client

Flag of UNITED STATES
Belmont, United States
5.0
1
Payment method verified
Member since Apr 12, 2015

Client Verification

Other jobs from this client

page replacement algorithm
$10-30 USD
Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.