Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

KILL -9

Name: Anonymous 2010-11-19 16:46

Just donated blood, feeling lightheaded, realized I have programming project due by tonight. Confused as fuck, NEED HALP!


In this assignment, you are to write a program that spawns and controls multiple processes.  The program should use system calls such as fork(), wait(), execvp() to manage the processes.  The program should use signal system calls to communicate between the processes.  The processes should coordinate a simple command structure where the main process is “base” and the child processes are “planes”.

The base process is the main process.  It should run in a simple loop, prompting the user for an input command.  Valid input commands include “launch”, “bomb N”, “status”, “refuel N”, and “quit”.  Invalid commands should produce a suitable error message.  Upon receiving the command to quit, the program should end.

The launch command should cause a child process to start.  All child processes should execute the same code.  A child process should execute a simple loop, counting “fuel” downward from 100 at a rate of 5 fuel/second.(sleep command)  Every 3 seconds it should report its fuel status by printing out the line “Bombadeer N to base, # fuel left”, where N is the child’s process ID.  Upon receiving the signal SIGUSR1, the child process should print out the line “Bombadeer N to base, bombs away!”, where N is the child’s process ID.  Upon receiving the signal SIGUSR2, the child process should “refuel”, resetting its fuel value to 100.  Upon reaching zero fuel, the child process should send the signal SIGUSR2 to the main process, and then exit.

The main process must maintain a list of process IDs of the child processes.  Given the bomb N command, the main process should send the signal SIGUSR1 to child process ID = N.  Given the refuel N command, the main process should send the signal SIGUSR2 to child process ID = N.  Given the status command, the main process should list the child processes ID’s.  Upon receiving the SIGUSR2 signal, the main process should print out “SOS!  Plane has crashed!”.  The main process will not know which child process sent the signal, so if this happens the status list will thereafter be in error.

All output from child processes should be printed to a second terminal, not the one connected to the main process.  This can be accomplished by opening a second terminal and having the child processes open /dev/pts/2 (or the appropriate device) for output.

inb4 teacher cannot spell bombardier correctly
also i love kittens

Name: Anonymous 2010-11-19 17:42

This thread has been closed and replaced with the following thread:

Subject:
Testing for algorithm equivalence
Name:
Email:


So I've been thinking, is it possible to write a program that takes two source codes an input and tells if they implement the same algorithm? Like these two:

[code]hax(int anus)
{
    int i = anus;
    int j = 1
    while(1)
    {
        j *=

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List