1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

hello guys its urgent plz help in writing a program........

Discussion in 'C#' started by venkat penmetsa, Feb 23, 2014.

  1. #1
    Problem: You will write a program in C which will be tested on the department’s Linux system. Your program will demonstrate mastery of pipe, fork, and related systems calls. Your program will sort a file (following the procedure described below) which will be given as input on the command line. The input file will be text format, one entry per line. The size of the file is not limited. Your program writes to standard output the sorted data (one entry per line of output), or an informative error message (e.g. if the input file is not given or does not exist). Your program should also take as an optional input the flag –T. This flag will cause test output to be printed.

    Procedure: Your program will work recursively. If the data file to be sorted is 10 entries (10 lines) or less, you sort the file internally, using any sorting algorithm you wish (but you may not use any system or library sort functions, nor may you use code taken from the web, textbook, or anywhere else). If the data to be sorted contains more than 10 entries, you fork two processes. Each process sorts one half of the entries (using this same procedure), and the parent process merges the two sorted data sets. The merge procedure should proceed by reading an entry at a time (i.e. read a single entry from a child at a time), not by reading all of the data from one child, then all of the data from the next child then merging those in memory. You will alternate reading from the two children as indicated by the data, as in a standard mergesort (you should review this algorithm if you do not remember it well).
    For example, if the data file contains 40 entries, the parent will fork 2 children, and each of those children will fork two more children for a total of 7 cooperative processes.
    If the testing flag is passed as a parameter, each child process forked should print its sorted output in the following format after sorting the data: child process PID: entry number: entry (example - 22767: 1: anentry). The output from sibling processes may be intermixed.
    Your program may not use named pipes, only anonymous pipes as described in the notes and class. Your program must be well documented internally (through comments and informative variable names) and externally (through a text document describing the program as well as how to run the program and any limitations), and the source code must be well formatted.
    venkat penmetsa, Feb 23, 2014 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Likes Received:
    Best Answers:
    Trophy Points:
    That sounds like a very concise requirement - what's the problem? You didn't pay attention in class?
    PoPSiCLe, Feb 24, 2014 IP
    sarahk likes this.
  3. venkat penmetsa

    venkat penmetsa Member

    Likes Received:
    Best Answers:
    Trophy Points:
    nooooo its very urgent for my friend........... he was sick sooooo:(
    venkat penmetsa, Feb 24, 2014 IP