Write C programs in Linux

I have attached the Lab referenced in this description. Please look at the notes and hints as requirements.

Q1: Fork Game

Write a C program that will start a race between 4 processes to get a number from the user inputs. The user will enter 4 numbers (1 to 4), the process that receives the first number (1) will be the winner and in the first place, processes afterward will get second, third and fourth place depending on the number they get from the user.

The program will start by using the fork() System call to create 4 processes, each process created is identified by a number from 1 to 4, this number indicates its creation sequence. For example, the first child process created get ID = 1.

After all, processes are created, the processes will start to request a number from the user. Each process will print the number it got from the user and also print its ID number. The parent does not participate in the race and waits for all child process to finish before it exits.
Notice: The numbers and the order of processes on your computer might be different.

Sample Output

Output.PNG

Submission:

  • Submit one file named “ForkGame.c”

Q2: Signals

Write a program that will administer a test for users. The questions and answers for the test are written in two separate files. The program will display a question to the user and accept user answers. The test will compare user input to answers. If the answer is correct, the program will add the corresponding points to the Total points for the user.

  • The program keeps track of the total amount of time the user has been taking the test vs. time remaining.
  • The program also displays a notification every minute to inform the user of time passed vs. time remaining.
  • The program does not store any points, questions, or answers. All information is stored in files.
  • The program terminates the Exam when time runs out and displays the total points earned.
  • The program uses signals and signal handling to keep time.

Files:

  • Questions_Exam
    • The first line is the total amount of minutes for this test.
    • Each line contains a question.
    • No space between lines.
    • Sample:
    10″How many states in the U.S.A ?””How many legs a cat has?””What is the best school in Erie ?””Who is the Tesla of our era ?”
    • Answers_Exam
      • Each line contains the answer to the corresponding question in the Questions_Exam file and how much points this question is worth.
      • The two fields are separated by a space.
      • No space between lines.
      • Sample:
    50 1 4 1PSU 10Elon 100

    Notes and hints:

    • Signals Handling function

    Sample Output:

    Q1.PNG

Submission:

  • One file named “Exam.c”
Research Paper 101
Calculate your paper price
Pages (550 words)
Approximate price: -

Reasons to trust Research Paper 101

On Time Delivery

We pride ourselves in meeting the deadlines of our customers. We take your order, assign a writer but allow some more time for ourselves to edit the paper before delivering to you. You are guaranteed a flawless paper on a timely manner...

24x7 Customer Live Support

Our team at Research Paper 101 is committed to handling your paper according to the specfications and are available 24*7 for communication. Whenever you need a quick help, you can talk to our writers via the system messaging or contact support via live chat and we will deliver your message instantly.

Experienced Subject Experts

Online Experts from Research Paper 101 are qualified both academically and in their experiences. Many are Masters and Phd holders and therefore, are qualified to handle complex assignments that require critical thinking and analyses...

Customer Satisfaction

We offer dissertation papers as per students’ wishes. We also help craft out the best topics and design concept papers. By ordering with us, you are guaranteed of defending and making through those hard faced professors in the defense panel!

100% Plagiarism Free

We at Research Paper 101 take plagiarism as a serious offence. From the start, we train our writers to write all their papers from scratch. We also check if the papers have been cited appropriately. Our website also has a tool designed to check for plagiarism that has been made erroniusly. In essense, the paper you get will be 100% legit...

Affordable Prices

We understand that being a student is very challenging, some students balance between work and studies in order to survive. We therefore offer pocket friendly rates that are very competitive in the market.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.

error:
Need help? Chat with Us