It's UWAweek 48


This forum is provided to promote discussion amongst students enrolled in CITS2002 Systems Programming.
Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

Displaying selected article
Showing 1 of 919 articles.
Currently 4 other people reading this forum.

 UWA week 34 (2nd semester, week 5) ↓
SVG not supported

Login to reply

6:14am Sat 27th Aug, Christopher M.

Hello, Your questions seem more related to programming in general, rather than this 1st project or C, in particular. While very relevant questions, they're best discussed with a project partner. Some of the issues and choices were mentioned in Workshop-5, which you appear to have attended or watched. ANONYMOUS wrote:
> 1. I am thinking that we only want to read the Estimate file once and somehow store its values, but I'm not sure how to approach this. If it was in python, I would think to just store the data in a dictionary, but I'm at loss as to how to store this - I was thinking maybe in arrays or something?
Each file should be read only once; file I/O is expensive (slow), and unnecessary because we can store the contents of (not-too-big) files in our data-structures in much faster memory. While Python is widely lauded as a first programming language, many educators (worldwide) have been critical that it encourages/students to first think that dictionaries can easily address nearly every problem. In this project you'll find arrays offer advantages such as random-access to elements (not to mention, considerably less memory overhead).
> 2. You mentioned that we shouldn't be going over the crontab file again and again. But I don't really understand how we keep track of all the entries otherwise - especially ones that have * and may be executed multiple times a month. Should we be going over all the crontab entries every minute to check? Secondly, is it reasonable to try and store each line of crontab in an array?
I stated that we should not read the crontab *file* multiple times but, once its data is stored in the program's memory, you can quickly access it as often as necessary. We're not worrying about excessive speed but, as seen in the workshop, examining every crontab entry (in memory) for each of the 44000+ minutes in a month, took less than 0.02seconds.
> 3. I am trying to think of the best way to keep track of which processes are running and then which processes are terminated. Would keeping an array of the processes running, and then removing the process once they have terminated seem reasonable?
The first part of this point was demonstrated in Workshop-5. Perhaps rather than thinking/asking about just one approach, think also of another data-structure that can also be used to easily add, search-through, and remove data, and compare the two. Hope this helps (though not really questions for the forum).

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  1:17AM Sep 14 2022
Privacy policy