Preview

Homeos

Satisfactory Essays
Open Document
Open Document
369 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Homeos
Section A, B, C, D, E

Operating System Spring 2013 Assignment # 02

Submission Deadline Thursday, 14th March 2013 at Sharp 11:55pm

Question # 01 (10 Marks)
In this programming exercise, you are asked to use the fork() programming construct to create some number of processes, specified on the command line - for example - the command ./FORK1.exe 6 should create 6 new simultaneously-executing processes as quickly as possible. Each process except the original should then print out its own process ID using getpid() which returns the current process ID when it is called. After printing out the process ID, each process should wait for two (2) seconds by calling sleep(2) and then exiting: exit(). The main - parent process should wait three (3) seconds before exiting. Use atoi() to convert the input from command line from ascii to integer.

Question # 02 Part (a) (shell alike) 10Marks
Write a shell-like program that illustrates how LINUX spawns processes. This simple program will provide its own prompt to the user, read the command from the input and execute the command. It is sufficient to handle just argument-less commands, such as ls and date.

Part (b) (passing and parsing arguments) 10 Marks
Make the mini-shell (from the previous part) a little more powerful by allowing arguments to the commands. For example, it should be able to execute commands such as more filename and ls –l ~/tmp etc. You must handle other commands as well.

Part (c) (Redirecting output using dup2) 15 Marks
Add to the MoreShell ability to execute command lines with commands connected by pipes. Use dup2 system call to redirect IO. For Example: ls -l | wc .

Question # 02 (15 Marks)
Write a program that uses fork() to create one child process named CHILD. Using pipe(), establish a pipe between parent and child. Using dup2(), attach file descriptors for stdin and stdout to the pipe. Parent takes data from the keyboard (stdin) and adds a suffix "-PARENT-PROCESSED" to the data. Then

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
  • 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

    IT/210 Appendix D

    • 453 Words
    • 4 Pages

    Up to this point, you have identified the processes the program must perform, but you have not given any consideration to exactly how the processes work together to solve the problem. At this point, you must generate a description of the processing using pseudocode, a natural language description of the processing the application must perform.…

    • 453 Words
    • 4 Pages
    Powerful Essays
  • Powerful Essays

    asos

    • 473 Words
    • 2 Pages

    • ASOS is experiencing international expansion and growth. Sales outside of the UK grew by 64% to £332.6 million. Additionally, the company experienced a 91% growth in the US. International business now accounts for 59% of total sales.…

    • 473 Words
    • 2 Pages
    Powerful Essays
  • Good Essays

    Home Owners

    • 602 Words
    • 3 Pages

    Under a Christian-based community, the Church will designate members in the congregation to the board of the Homeowners Association or “HOAs” responsible for establishing rules and guidelines for the community. Some of these rules limit what the homeowner can have in their front yard and how often it is maintained. For example, the grass must be cut, trimmed, and debris removed in a timely matter, but not to exceed 10 days. Others, states what type of activities, dates and times they are held, and the type of attire that can be worn also the type of language that is acceptable in the community. For example, no pants or shorts can be worn below the waistline revealing undergarments, no explicit or sexual clothing, nor foul or disrespectful languages are used within the premises of the community. HOA boards implement rules like these to keep the neighborhood consistent with the Christian belief and the highest moral and ethical standard possible. The board is also responsible for publicizing and enforcing these rules under the guidance of the Church Spiritual Leaders as they apply. Typically, if a homeowner violated a rule, they will receive a warning letter or phone call about compliance within a certain time frame. If no actions were taken to resolve the issue, matters will be forwarded to the Church for the appropriate actions to resolve the problem.. The HOA has certain social responsibilities to the community. This responsibility is influenced by religious beliefs and the needs of the community to uphold and practice their faith, unlike conventional communities, religious communities live on a biblical base principle. The rules and regulations have to match this belief so not to cause conflict between the law and religion. Examples would be no landscaping or maintenance to the yard on the Sabbath, not to include emergencies. No homeowner will be made to comply with…

    • 602 Words
    • 3 Pages
    Good Essays
  • Good Essays

    ASOS

    • 549 Words
    • 3 Pages

    In the fashion industry the cycle is often short as trends and tastes change. For example, an…

    • 549 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    Linux Interview Questions

    • 10428 Words
    • 42 Pages

    13. What happens to a child process that dies and has no parent process to wait for it and what’s bad about this?…

    • 10428 Words
    • 42 Pages
    Powerful Essays
  • Good Essays

    Casa de Diseno

    • 672 Words
    • 3 Pages

    Integrative Case 7, Casa de Diseno, involves evaluating working capital management of a furniture manufacturer. Operating cycle, cash conversion cycle, and negotiated financing needed are determined and compared with industry practices. The student then analyzes the impact of changing the firm’s credit terms to evaluate its management of accounts receivable before making a recommendation.…

    • 672 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Shell Programing

    • 2683 Words
    • 11 Pages

    commands in it. Shell scripts usually begin with a #! and a shell name (complete pathname of shell).…

    • 2683 Words
    • 11 Pages
    Good Essays
  • Good Essays

    Java Progamming

    • 7830 Words
    • 32 Pages

    Exercise CheckPassFail (if-else): Write a program called CheckPassFail which prints "PASS" if the int variable "mark" is more than or equal to 50; or prints "FAIL" otherwise.…

    • 7830 Words
    • 32 Pages
    Good Essays
  • Satisfactory Essays

    10. What is the importance of shell? (without shell, a user cannot do anything on the system because it acts as the interface between the user and the operating system)…

    • 518 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Compiler Construction

    • 376 Words
    • 3 Pages

    Interpreter-a program that reads an executable program and produces the results of running that program…

    • 376 Words
    • 3 Pages
    Good Essays
  • Good Essays

    C++ solution

    • 459 Words
    • 2 Pages

    pointers are required in order to navigate through the file while reading or writing. There are certain default actions of the input and the output pointer. When we open a file in read only mode, the input pointer is by default set at the beginning. When we open a file in write only mode, the existing contents are deleted and the file pointer is attached in the beginning. C++ also provides us with the facility to control the file pointer by ourselves. For this, the following functions are supported by stream classes: seekg(), seekp(), tellg(), tellp().…

    • 459 Words
    • 2 Pages
    Good Essays
  • Powerful Essays

    coach carter

    • 1349 Words
    • 6 Pages

    - analyze functional descriptions of small objects, which require the use of such technologies as sequential file access, dynamic memory allocation, robust user input and formatted program output;…

    • 1349 Words
    • 6 Pages
    Powerful Essays