Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 Introduction This group assignment uses Pintos, the academic operating system that you have already used in lab sheet 3. In fact, the work in

1 Introduction This group assignment uses Pintos, the academic operating system that you have already used in lab sheet 3. In fact, the work in this assignment is a direct continuation of lab sheet 3. Here, you are required to continue your study and understanding of Pintos in order to implement two missing functionalities in Pintos: - Argument passing for user programs - System calls that are missing from Pintos While not a requirement, we very strongly advise you to have run through and totally finished lab sheet 3 before starting this assignment. The work accomplished there will give you firm base to start on the assignment and approach Pintos code base and concepts in a sensible manner.

2 Argument Passing for User Programs (25 marks) Currently, Pintos does not support passing arguments to newly-created processes. For example, running echo or echo x y z currently gives the same result in Pintos; x y z, three parameters, arent managed by the current code and are simply seen as part of the filename. The aim of this argument passing task is to solve this issue. To implement this functionality, you first need to extend the process_execute function so that instead of simply taking a program file name as its argument, it reads the whole command line and divides it into words, the delimiter being the space character. The first word being the program name, the second word is the first argument, and so on. For example, with your new implementation process_execute(echo x y z) must execute the echo command on the parameters x, y and z. Please know that multiple spaces must not create issues and must be equivalent to a single space, process_execute("echo x y z") must be equivalent to the previous example. This first part of cutting the full command line into the command itself and its parameters is called argument parsing or tokenization. For this part, we recommend you take a look at the strtok_r function, prototyped in lib/string.h and implemented with thorough comments in lib/string.c. You can find more about the Linux implementation of it by looking at the man page (man strtok_r at the prompt). Once you have implemented this basic parsing, you need to ensure that the command and its parameters are properly passed to the stack of your process structure. setup_stack is a good starting point for that. You will need to use the already defined stack pointed to by the esp variable (already used in lab sheet 3) and populate it properly with the command name and its parameter. You can impose a reasonable limit on the length of the command line arguments, for example, you could limit the arguments to those that will fit in a single memory page, 4KB. Please do not base your limit on the maximum 128-byte command-line arguments that the pintos utility can pass to the kernel. After implementing this first part and testing it properly, you would have achieved argument passing totally.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

what are the provisions in the absence of Partnership Deed?

Answered: 1 week ago

Question

1. What is called precipitation?

Answered: 1 week ago

Question

1.what is dew ?

Answered: 1 week ago