Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Operating System Expert

Assignment

  • What I'm covering:
  • General control flow
  • fork()
  • execlp()
  • Parameters
  • Makefiles
  • Additional Questions

General Control Flow/fork()

  • In the Controller:

int main(int argc,char** argv){

.....

for(i = 0;i < 4;i++){

int ret_pid = fork();

if ( ret_pid < 0 ) exit(1); //this means fork() failed

else if ( ret_pid == 0 ) !  //this is the child

else ...  //this is the parent (Controller)

}

return 0;

}

 

execlp()

  • This function call has a lot of gotchas that look very confusing at first glance.
  • The first argument to execlp is the string with the file name that will be executed...and so is the second.
  • Think about your own program being called from the command-line ( > ./a.out arg1 arg2 ). In this case, the value of argv[0] in the program is "a.out".

Same thing applies when using exec, you just have to be explicit about it.

 

More execlp() and parameters

  • The rest of the parameters to execlp are strings containing the rest of the arguments, in our case, the numbers that the calculator will be operating on.
  • These will be passed to Controller as arguments, and from there, they will be passed to Calculator.
  • No matter what, the last argument to execlp MUST be a null-terminator (NULL or (char*) 0).

This is because the argument list must be null-terminated, just like any other string.

 

Makefiles

  • This assignment requires that TWO executables be created: the Controller and the Calculator.
  • Because of how Eclipse generates its makefiles, if you try to do this in a single project, Eclipse will whine. I recommend doing your coding in a normal text editor (gedit, emacs, vi, bluefish, etc.), and writing your own makefile.
  • There are plenty of makefile tutorials online; but this project (and the next one) will not require a particularly complex makefile.

 

Makefile example

  • Here's the general format of a makefile entry:

[target] : [dependency1] ! [dependencyn] [command to execute]

  • In this example, when you call make target, the make program checks if any of the dependencies of target are out of date.
  • If one or more of them is out of date, the command to execute is run.

Operating System, Computer Science

  • Category:- Operating System
  • Reference No.:- M9525975

Have any Question?


Related Questions in Operating System

Assignment -building a multi-threaded web server using c

Assignment - Building a multi-threaded web server using C and p threads, following the model from the lecture. Your program will have one thread acting as a dispatcher thread, listening fornetwork connections with reques ...

Discussion question this research assignment will give

Discussion Question : This research assignment will give further information on the nature and workings of multi-tasking and multi-processing operating systems. All information reported in this assignment is to be in the ...

Question research hex editors available for mac os and

Question : Research hex editors available for Mac OS and Linux. Based on the documentation, how easy would validating these tools be? Select at least two hex editors for each OS, and discuss what you would do to validate ...

Question description of lasa in this assignment you will

Question: Description of LASA: In this assignment, you will select a real-world operating system (can be for a PC, server, tablet, handheld, or embedded device). You will introduce the operating system and its components ...

Foundation of information technologyresearch types of

Foundation of Information Technology Research types of operating systems that are currently available and provide a scenario in which the operating system you chose would be appropriate to be used in this situation. Expl ...

State the required answer precisely and then provide proper

State the required answer precisely and then provide proper explanation. It is not enough to provide one- word or one-line answers. Briefly describe the following concepts and indicate how they are related in the context ...

Question students working at individual pcs in a computer

Question : Students working at individual PC's in a computer laboratory send their files to be printed by a server that spools the files on its hard disk. Under what conditions may a deadlock occur if the disk space for ...

Show all stepssuppose that the following processes arrive

Show all steps Suppose that the following processes arrive for execution at the times indicated. Each process will run the listed amount of time. in answering the questions, use non-preemptive scheduling and base all dec ...

Question topic computerized operating systems os are almost

Question: Topic: Computerized Operating Systems (OS) are almost everywhere. We encounter them when we use out laptop or desktop computer. We use them when we use our phone or tablet. Find articles that describes the diff ...

Catalog course descriptionin this course students carry out

Catalog Course Description In this course students carry out independent research in a significant technical area of information, network, and computer security. The student is to investigate a technical area, research i ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As