I'm VERY new to perl, so you'll have to give me a break here. I just have a question about language of choice. I have assignment to do for school. I haven't used perl before, but I have done scripts. I have an "ok" knowledge of C. I would like to learn some perl, so was thinking of doing this assignment in Perl. But the assignment is also marked on efficiency. So which would be faster in this application? Or what are your suggestions? Thanks Write a simple scheduler called myscheduler that accepts commands along with user ids, and prioritizes their execution based on past history of the users' requests. Specifically,....
your program takes names of two files - infile and outfile - as commmand-line parameters. infile contains a list of commands to execute and details related to each command. This information is provided in the form of (serial number, userid, est-time, command) quadruples, so that each line of infile contains a three digit serial number (beginning with 000), a three digit user id, an estimated amount of cpu time (in milliseconds) required for completing the request, and finally the command to be executed with its options, where the fields are separated by single spaces. Your program reads the entire file, puts the commands (with relevant details) in a queue, ordering the requests according to the shortest job first scheme. The shortest job first scheme carries out commands with lower estimated cpu time requirements before commands with higher estimated cpu time requirements. As myscheduler executes commands, it reorders remaining requests in the queue based on the discrepancy in the estimated amount of cpu time required by the commands which have already been executed. Specifically, after executing a command, if the program sees that the actual amount of cpu time taken is larger than the estimated time, it increases estimated time for each remaining command request by the same user by the same percentage, and then re-orders the queue; however, if the actual time is less than the given estimate, it does not change anything. Your program continues until all commands have been executed, and finally, writes to outfile the order in which the commands were executed (by writing serial numbers of requests in the order in which they were executed - one serial number per line), followed by the average amount of discrepancy in estimates for commands requested by each user (by writing a userid, followed by average amount of discrepancy (in milliseconds) with respect to the estimates provided in infile, followed by discrepancy with respect to the modified estimates at the time of the execution of the commands) - one user's information per line). Fields on the same line in the discrepancy part of outfile should be separated by single spaces.

20041120 Edit by castaway: Changed title from 'Newbie Question'


In reply to Preferred language for scheduler assignment? by kozter

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.