Especially, we will validate the buffer before calling read() and write(). 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./* Call the function to tokenize file_name */ bool load ( const char * file_name, void ( ** eip ) ( void ), void ** esp ) AlgorithmsĪ) Before actually calling any file system functions, we will validate the arguments using methods of Task 2. 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. 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. The main goal is to clearly understand systems calls and argument passing in user programs by implementing a set of system calls in. 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. Implement argument passing Example: ls sort of works but ls l a doesn’t work You must pass argv and argc to user programs 2. 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. 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. 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. In file /pintos/src/userprog/process.c: / Call the function to tokenize filename / bool load. For the latter, you only need to use functions defined here, without the need to modify anything here. 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. 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.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |