Answered step by step
Verified Expert Solution
Question
1 Approved Answer
All of the questions below should be answered about a Linux system ( not Windows or xv 6 ) . Question 1 In chapter 5
All of the questions below should be answered about a Linux system not Windows or xv
Question
In chapter the example program pc calls wait in the parent process. What happens if we call wait from the child process instead? Specifically what does wait return? If it indicates an error, use the function perror to print the error.
Question
In the manual page for execlp the RETURN VALUE section indicates that it returns on error. Is there any reason why we need to check the return value? In other words, given the snippet below, is the if statement necessary?
if execlpwcwcl NULL
perrorexeclp;
exit;
Or is the following equivalent?
execlpwcwcl NULL;
perrorexeclp;
exit;
Explain your answer.
Question
execlp is not a system call; it is a library function. Upon which system call is execlp based in Linux? You can either use the technique in Question or read the manual page.
Question
It should not be a surprise that printf is a library function that ultimately calls write Let's use the system call tracer, strace to figure out what system call malloc is based on Compile the code below into a program called malloctest. Then run: strace malloctest It will produce a lot of output, but we're only concerned with the last few lines. Look for the two calls to write Between them is the system call upon which malloc is based. What permissions are granted on memory allocated by malloc Also, what is the last system call executed by malloctest?
#include
#include
int
main
printfHello
;
printfp
malloc;
return ;
Question
If it takes a long time to switch back and forth between user and kernel mode for a system call, this can ultimately limit the performance of an operating system. Let's find out how long it takes to go from kernel to user and back. Since we want the kernel to do as little work as possible when our system call is used, let's pick on the write system call. If it is given an invalid file descriptor, a NULL pointer, and a zero length, it will simply check for one of those conditions and fail, eg write NULL, ; If we get the current time before running this call many times and the time when we finish and then do a little arithmetic, we can determine the time cost of a single call. The system call, clockgettimeCLOCKREALTIME,... uses a sufficiently precise timer for this exercise. How long does it take to perform N system calls where N is and how long does it take do
Question
Given three jobs, A B C which take and units of time to complete. They arrive at the scheduler at very close to the same time, so that the scheduler can choose the ordering of the jobs simultaneously.
with the FIFO scheduler, the jobs are run in alphabetical order, what is the average turnaround time? what is the average response time?
with the SJF scheduler, what is the average turnaround time? What is the average response time?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started