Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 3 execlp ( 3 ) is not a system call; it is a library function. Upon which system call is execlp ( 3 )

Question 3
execlp(3) is not a system call; it is a library function. Upon which system call is execlp(3) based in Linux? You can either use the technique in Question 4 or read the manual page.
Question 4
It should not be a surprise that printf(3) is a library function that ultimately calls write(2). Let's use the system call tracer, strace(1), to figure out what system call malloc(3) 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(2). Between them is the system call upon which malloc(3) is based. What permissions are granted on memory allocated by malloc(3)? Also, what is the last system call executed by malloctest?
#include
#include
int
main(){
printf("Hello
");
printf("%p
", malloc(1000000));
return 0;
}
Question 5
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(2) 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, e.g. write(-1, NULL, 0);. 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, clock_gettime(CLOCK_REALTIME,...), uses a sufficiently precise timer for this exercise. How long does it take to perform N system calls (where N is 1,000,000) and how long does it take do 1?
Question 6
Given three jobs, A, B, C which take 200,100, and 300 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

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

Online Systems For Physicians And Medical Professionals How To Use And Access Databases

Authors: Harley Bjelland

1st Edition

1878487442, 9781878487445

More Books

Students also viewed these Databases questions