Preview

Fork System Call

Satisfactory Essays
Open Document
Open Document
258 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Fork System Call
Exp#2 fork system call
Aim
To create a new child process using fork system call.
Algorithm
1. Declare a variable x to be shared by both child and parent.
2. Create a child process using fork system call.
3. If return value is -1 then
a. Print "Process creation unsuccessful"
b. Terminate using exit system call.
4. If return value is 0 then
a. Print "Child process"
b. Print process id of the child using getpid system call
c. Print value of x
d. Print process id of the parent using getppid system call
5. Otherwise
a. Print "Parent process"
b. Print process id of the parent using getpid system call
c. Print value of x
d. Print process id of the shell using getppid system call.
6. Stop
Result
Thus a child process is created with copy of its parent's address space.

Exp#2 wait system call
Aim
To block a parent process until child completes using wait system call.
Algorithm
1. Create a child process using fork system call.
2. If return value is -1 then
a. Print "Process creation unsuccessfull"
3. Terminate using exit system call.
4. If return value is > 0 then
a. Suspend parent process until child completes using wait system call
b. Print "Parent starts"
c. Print even numbers from 0–10
d. Print "Parent ends"
5. If return value is 0 then
a. Print "Child starts"
b. Print odd numbers from 0–10
c. Print "Child ends"
6. Stop
Result
Thus using wait system call zombie child processes were

You May Also Find These Documents Helpful

  • Good Essays

    Unix processes are instances of an executed program. UNIX, being a multi task operating system handles thousands of processes at a time. We are able to check on what processes are currently running by typing ps at the UNIX prompt. Depending on the options used with the ps command, we can see different outcomes such as $ps -ef | more. This will list all the processes in the system. Some items you might see using the ps command are PID which is the process ID number, TT or TTY shows the controlling terminal for the process. If there is no controlling terminal then a question mark is used.…

    • 567 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    NT1310 Unit 3 Homework

    • 1253 Words
    • 5 Pages

    A1) The shell goes to “sleep” until the command has been processed. You can run a program in the background, which will allow you to run more than one at a time.…

    • 1253 Words
    • 5 Pages
    Satisfactory Essays
  • Good Essays

    Unit 59 Assignment 3

    • 645 Words
    • 3 Pages

    The process of how the subroutine works within an operating environment is as follows. While the main part of the program is running, there will be a call command sent to the CPU to tell it to stop wherever the program is at, store the W, Z and status along with where in the main program the CPU is at in the stack. Then the main program is cleared from memory and the subroutine is loaded for the CPU to start processing the code. Once the subroutine has finished, the subroutine code is deleted from memory and the CPU will load up the main program back on and will retrieve from stack the stored information (W, Z and status) which will allow the CPU know exactly where it needs to start from.…

    • 645 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    Unit 3 network discovery

    • 1031 Words
    • 5 Pages

    What does the shell do while a command is executing? What should you do if you do not want to wait for a command to finish before running another command?…

    • 1031 Words
    • 5 Pages
    Powerful Essays
  • Better Essays

    NULL); } void FCFS() { getch(); printf("\n\n Background FCFS Process Scheduling \n\n"); printf("\n\n Process Burst Time Waiting Time Turnaround Time \n"); printf(" ------------------------------------------------------- \n"); do { printf(" %d \t\t %d \t\t",stbck->prn,stbck->bt); stbck->wt = temp->tt; stbck->tt = temp->tt + stbck->bt; printf(" %d \t\t %d\n\n",stbck->wt,stbck->tt); ttl_wt…

    • 401 Words
    • 2 Pages
    Better Essays
  • Powerful Essays

    Hw3 7

    • 1263 Words
    • 5 Pages

    A PID number is an identification number assigned to a command running in the background, which can be used to differentiate between commands. The PS (process status) utility…

    • 1263 Words
    • 5 Pages
    Powerful Essays
  • Satisfactory Essays

    Code Switching Analysis

    • 304 Words
    • 2 Pages

    Code-switching in my day to day life is essential. As a receptionist for a marketing firm in Dallas, my tone switches depending on who I'm communicating with. With clients, my tone is very proper and professional. Around my bosses and coworkers, my tone remains proper and professional, but not so much as it would be while communicating with clients. Around friends and family, my tone would change drastically to a more apathetic, casual feel. Although I've never been in a situation where lack of adaption has caused problems, problems would definitely occur if I were to use the same laid back, casual tone with huge clients in the firm I work with. They would then have a dubious, unprofessional opinion of me. If I were to use a casual tone with…

    • 304 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    The play deals with an inspector, named Goole, who arrives by the Birling family, who is celebrating Sheila's engagement to Gerald Croft. He tells about Eva Smith's suicide. After lots of questions it turns out that they are all more or less responsible for this tragically death and after the inspector left they find out that he wasn't a real inspector and that no girl died.…

    • 1173 Words
    • 5 Pages
    Good Essays
  • Satisfactory Essays

    Which type of departmentalization achieves economies of scale by placing people with common skills and orientations into common units?…

    • 1434 Words
    • 6 Pages
    Satisfactory Essays
  • Best Essays

    System Based

    • 2941 Words
    • 12 Pages

    Roth, W., & Roychoudhury, A. (1993). The concept map as a tool for the collaborative…

    • 2941 Words
    • 12 Pages
    Best Essays
  • Satisfactory Essays

    9 Windows System Operator

    • 395 Words
    • 2 Pages

    quite bulky. Also, they are not made by recycling materials so they are not very…

    • 395 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Process Control

    • 6285 Words
    • 26 Pages

    Surge Tank Design CHE4042F Process Dynamics and Control Project 1 20 April 2013 Group 26 Table of Contents List of Figures ii List of Tables ii Glossary iii A. Analysis of Plant Data 1 B. Simulation of Surge Tank 2 i. Modelling the Surge Tank in Xcos 2 ii. Frequency Fluctuations in Density Data 5 iii.…

    • 6285 Words
    • 26 Pages
    Powerful Essays
  • Good Essays

    When a program starts in an object-oriented language, information is put into compartments. This is what allows the program to compute things. We must understand how we are able to take an e-business and when examining an order that has been placed within a program. All of the data is put into the right compartments, but we must consider what happens when the order needs to be submitted. The program has to have the capability of taking the data from the compartments and saving it to a file that can be stored and accessed. Once the program is terminated, any data that hasn’t been backed up is lost. In an e-business or any business for that matter, backing up data is crucial in order to prevent having to re-access everything into the systems when we need it. “File processing is one of the most important capabilities a language must have to support commercial applications, which typically store and process massive amounts of persistent data” (Deitel & Deitel, 2002). Therefore, it is even more essential for an e-business because they do not have the luxury to rely on manual paper systems. A business needs this capability to store the information they currently have by creating databases where we are able to review multiple entries of data, as well as transfer the same database from one instance of the program to a different instance that is on another computer. Therefore we are able to have the customer input the order details as the product number, quantity and other information. We may than use the interface to click the process through in order to record the order information and then produce the final bill for a customer. The order information would then be stored in a text file or any other format which would then be an interface that is designed for a server or department store’s computer for further processing. Overall the Java-based application that is able to have file access and file processing methods are essential for e-business’s in any environment…

    • 382 Words
    • 1 Page
    Good Essays
  • Good Essays

    System Moduling

    • 1399 Words
    • 6 Pages

    Michael Porter: Author and researcher in the field of organizational strategy Proposes 2 paths for org strategy:…

    • 1399 Words
    • 6 Pages
    Good Essays
  • Good Essays

    system integration

    • 4949 Words
    • 27 Pages

    meetings and workshops, it can only be stated that the word has multiple and misunderstood…

    • 4949 Words
    • 27 Pages
    Good Essays