poltaloha.blogg.se

Pintos project2 argument passing
Pintos project2 argument passing









pintos project2 argument passing
  1. Pintos project2 argument passing how to#
  2. Pintos project2 argument passing manual#
  3. Pintos project2 argument passing code#

That is, it just simply executes a file with a given name, giving nothing to file that is being executed. In Project 3, we will be implementing features such as paging so that the OS can run user programs which need more than 4KB of memory.Implement argument passing to support passing arguments to threads.Ĭurrent process_execute() does not support arguments. You should have now have an OS that is able to run a lot of user programs, atleast the ones that need at least less than 4KB of memory.

pintos project2 argument passing pintos project2 argument passing

Remember childs may exit prematurely or, in some cases the parent must have already finished execution, so you need to handle that case properly. Also children need to have a pointer to a parent so that they can signal to the parent once they have exited. For the specical case of write to STOUT_FILENO(1), just use the system call to write to console.įor implementing exec and wait system calls, a thread needs to maintain a list of child processes so that you can call wait on those processes. Remember to acquire and release locks for implementing file system calls. Use that to open, close, read and write to files. For filesystem calls, we have the filesystem interfaces in filesys. Once that is done, we can figure out which system call is being called. Check whether it is null or not and also use thread_get_pagedir() to check if the pointer points to the memory of a user process.

Pintos project2 argument passing manual#

Refer to the manual which states how the stack must look at the end.įor system calls, you need to first check whether the pointer passed to you by the user program is valid or not. This will have to be done once in process_execute and start_process. You will be needing this when you start pushing these arguments into the stack. Store the original command line arguments in another variable. The first step to solve this is to break your arguments using strtok_r. The first thing that you need to implement is argument passing, so that functions can at least pass arguments to other functions(In the user to the kernel context). It even does not print to output(From a user program perspective). The OS at this initial state is absolutely useless. This will also help you gain a better understanding as to how memory is allocated.

pintos project2 argument passing

Go through the pagedir.c file as you will be needing functions like pagedir_get_page and the like. You will need to make minor change in the exception.c file to handler user errors. For the latter, you only need to use functions defined here, without the need to modify anything here.

Pintos project2 argument passing code#

Let me break this down into a few main steps:ģ) Executing and waiting for child processes(Included in system calls but is the hardest to implement and hence you should carefully decide the data structures and functionality related to this problem)ĭo go through the code in userprog/ and filesys/ folder. Other than that there are also a few cases which will try to break the VM of the OS, as well as some which checks to see the extent to which file handling is implemented. You need to implement proper handling to ensure that faulty user programs are terminated by the kernel. There are about 76 test cases which will test the functionality of the system, out of which a lot of them will also try to break your OS. I will shed some light about what you must do to implement system call handling in PintOS. I think you might have a decent idea about system calls as this must have been taught in class. Project 2 is all about system call handling.

Pintos project2 argument passing how to#

I was able to complete all but 2 cases(, Sync-read and Sync-write, Still dont know how to complete these). So project 2 is supposed to be significantly longer and harder than project 1, but not to worry :D, it does involve more coding and better understanding of how system calls function but that will not be too hard for you guys if you have finished with project 1. Here are my thoughts and suggestions to help you in your project. I finished Project 2 of PintOS, and hoped to write a blog, but this has taken more time than imagined.











Pintos project2 argument passing