School of Physics, Mathematics, and Computing 
Not logged in (login)
help2002

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.

How do I ask a good question?
 
Options:
RSS cloud
Jump to:

There are 417 articles from Christopher McDonald

417 of 1097 articles shown, currently no other people reading this forum.

UWA week 45 - 2nd semester, 2nd exam week

photo Your feedback on the 2nd project
Tue 9th Nov 2021, 5:21am, Christopher M.
Thanks to those who completed our short survey on the 2nd project - I appreciate that you're often all-surveyed-out at this time of year, but it's great to get some specific feedback to help shape next year's unit. For those interested: https://teaching.csse.uwa.edu.au/units/CITS2002/feedback/2021/project2-feedback/...
photo UPDATED - Project-2 marks available
Mon 8th Nov 2021, 4:34am, Christopher M.
THE MARKING SCRIPT FOR PROJECT-2 HAS BEEN REVIEWED AND IMPROVED, resulting in the marks of 44 students being changed, some up, some down. Updated marks and feedback sheets have been changed in csmarks. Overall, the average has increased from 36.5(/50) to...

UWA week 44 - 2nd semester, 1st exam week

photo Re: EXAM 2019 Q3 (all 5)
Thu 4th Nov 2021, 12:42pm, Christopher M.
ANONYMOUS wrote: When you call pid = wait(&status); the call to wait() blocks until *any* of your child processes terminates. The value of status is updated to tell you *why/how* the child terminated, and the return value is the PID of the terminating child....
photo Re: EXAM 2019 Q3 (all 5)
Thu 4th Nov 2021, 11:39am, Christopher M.
ANONYMOUS wrote: I'm wondering why you've chosen to use threads, at all, in your solution. In 2019, we did not discuss threads in this unit, and students wrote their exam solutions in the same way we saw in Workshop 6. Why do you see this as requiring, or...
photo Re: Cannot access past exams/ exam solutions (all 9)
Wed 3rd Nov 2021, 3:21pm, Christopher M.
(after your exams) I'm happy to receive feedback about how the forum can be improved (once I've fixed our new bug of articles randomly being duplicated....)
photo Re: Cannot access past exams/ exam solutions (all 9)
Wed 3rd Nov 2021, 3:20pm, Christopher M.
Oh, no-one said it wasn't time consuming - slotted between all the queries about when Project-2 marks will be out!
photo Re: Advantage when taking exam online (all 4)
Wed 3rd Nov 2021, 3:18pm, Christopher M.
ANONYMOUS wrote: It's clearly an important question, but not necessarily one with an answer. Firstly it's too easy to suggest there is unconscious bias in the marking at all; and harder to defend, as you can't prove a negative. Further, let's imagine that,...
photo Re: 2018 Q4a) (2) (all 4)
Wed 3rd Nov 2021, 2:59pm, Christopher M.
ANONYMOUS wrote: I'd add/clarify: - it does have to be when *all* processes are blocked - ...Blocked on I/O - the OS can suspend as many processes as necessary (to reclaim as much memory as required) - transferring it to disk (t.... *what* to disk?) - to bring...
photo Re: 2020 exam question 2 (all 5)
Wed 3rd Nov 2021, 1:33am, Christopher M.
ANONYMOUS wrote: You will need to also define the List data-structure. You have defined an array of unknown size (would be more correct to use a pointer), but nowhere else in your code do you allocate space for this (expanding?) array. You want strcmp()...
photo Re: Helper functions in exam (both)
Wed 3rd Nov 2021, 1:19am, Christopher M.
Certainly permitted. There's no questions that state an answer must be written in only a single function. The only distinction made is between questions that only involve a function(s), and those that require a 'whole' program, because the main() function...
photo Re: Cannot access past exams/ exam solutions (all 9)
Wed 3rd Nov 2021, 1:17am, Christopher M.
ANONYMOUS wrote: Wrong. There was a problem with access to the past papers, for a couple of hours, on Saturday afternoon. (if you don't have anything nice to say....)
photo Re: 2020 Exam Q3 (both)
Tue 2nd Nov 2021, 5:07pm, Christopher M.
Hello James, I feel that you question is fully answered by the 2nd and 3rd last paragraphs of the question itself. Do those paragraphs not clearly explain the required actions to you?
photo Re: 2018 Q3 (both)
Tue 2nd Nov 2021, 5:03pm, Christopher M.
You can certainly used wait() - you need to wait until any child processes have terminated. But it's unclear why you want to use sleep - it suggest that you know, ahead of time, the correct length of time to wait for something. If you sleep for too long...
photo Re: Unequal Sized Partitions (Lecture 11) (both)
Tue 2nd Nov 2021, 4:58pm, Christopher M.
ANONYMOUS wrote: Also discussed here - found with a simple search. https://secure.csse.uwa.edu.au/run/help2002?p=np&a=973&all=y2 If you can find a free partition of the exact size, obviously that is preferred. However, just choosing one that is only a 'little...
photo Re: Parsing in exams (both)
Tue 2nd Nov 2021, 2:05pm, Christopher M.
ANONYMOUS wrote: Hello, I'm afraid that I don't understand the (need for the) question. strtok() is a standard C11 function, so I'm unsure why you would not use it. It's similar to strdup() and getenv() - we could write them ourselves, but why? strtok() does...
photo Re: Bitwise operators (both)
Tue 2nd Nov 2021, 3:51am, Christopher M.
ANONYMOUS wrote: In the exam you won't be asked to perform bitwise calculations, such as the one you've provided, but you will need to know how bitwise operators enable multiple data values to be stored, and extracted, from C base datatypes, such as integers....
photo Re: 2018 Semester 2 Exam - Question 1 (both)
Mon 1st Nov 2021, 6:40pm, Christopher M.
ANONYMOUS wrote: The simpler solution is perfectly fine (not an Algorithms unit :-)
photo Re: strdup compilation (all 4)
Mon 1st Nov 2021, 11:24am, Christopher M.
Just use it as if it were a standard C11 function (these days, it's an anachronism of standard C).
photo Re: C++ expecations (both)
Mon 1st Nov 2021, 5:44am, Christopher M.
ANONYMOUS wrote: There's no expectation that you understand and can repeat all the C++ technical information from the lecture. Very few students will have any experience writing any C++ code, and 'everyone' was focused on the 2nd project at the time....

UWA week 43 - 2nd semester, study break

photo Re: Project 2 sample solution (all 4)
Sun 31st Oct 2021, 6:36am, Christopher M.
ANONYMOUS wrote: I may be misunderstanding your explanation, but this is what I'm 'seeing'. Run these commands in a new, empty directory: prompt> date > file1 prompt> ln file1 file2 prompt> mkdir subdirectory prompt> ln file1 subdirectory/file3 prompt> ls -lR...
photo Re: Cannot access past exams/ exam solutions (all 9)
Sat 30th Oct 2021, 7:13pm, Christopher M.
We also posted our reasons for not providing solutions here: https://secure.csse.uwa.edu.au/run/help2002?p=np&a=877&all=y5
photo Re: Curly brackets (all 3)
Sat 30th Oct 2021, 7:10pm, Christopher M.
ANONYMOUS wrote: C's curly brackets are not simply there for readability, they define and constraint the scope of identifiers, variables, and statements. Python employs indentation for similar reasons, but the two are quite different. C's sequences: ...
photo Re: 2020 exam question 2 (all 5)
Sat 30th Oct 2021, 7:05pm, Christopher M.
Could you please re-post this with some indentation?
photo Project-2 sample solution and survey
Sat 30th Oct 2021, 7:04pm, Christopher M.
Hello Everyone, All anticipated 2nd projects have now been submitted, so you may now download a copy of the sample solution from: https://teaching.csse.uwa.edu.au/units/CITS2002/projects/duplicates-soln.zip The solution contains 2 header files, 6 C source...
photo Re: exam scope (all 5)
Sat 30th Oct 2021, 7:49am, Christopher M.
ANONYMOUS wrote: I'm VERY unsure where the information on: https://lms.uwa.edu.au/bbcswebdav/institution/Unit_Outlines_2021/CITS2002_SEM-2_2021/CITS2002_SEM-2_2021_UnitOutline.html even came from, but it does look like LAST YEAR'S unit schedule, as the...
photo Re: 2020 exam question 1 (all 9)
Sat 30th Oct 2021, 7:38am, Christopher M.
ANONYMOUS wrote: In practice most code you see will just use a big array, such as str[1000]; If genuinely worried about security, you wouldn't immediately used fscanf() is parse the input data, but would use fgets() to read the data into an array (but big??)...
photo Re: Question about the exam wording (both)
Sat 30th Oct 2021, 7:23am, Christopher M.
ANONYMOUS wrote: In all cases, answer the question that's asked, or state your assumptions if unclear. But, yes, if the question doesn't specify what the unsuccessful return value should be, then anything other than 0 is OK. ... In practice, the return value...
photo Re: 2018 Q4a and Q4b (all 3)
Fri 29th Oct 2021, 6:23am, Christopher M.
ANONYMOUS wrote: All a very good answer. Your first sentence is not a necessary condition (the OS could choose to reclaim/reuse memory at any time - even by only predicting the need to do it, based on recent execution patterns. It is also not necessary...
photo Re: 2020 exam question 1 (all 9)
Fri 29th Oct 2021, 4:51am, Christopher M.
ANONYMOUS wrote: On this one: Yery close, well done. Your variables named mincolour and colour, are both uninitialised pointers (they do not point to anywhere meaningful) so you cannot use them in any assignment or return statements until they correctly...
photo Re: 2018 Exam Question 3 (all 6)
Fri 29th Oct 2021, 4:45am, Christopher M.
ANONYMOUS wrote: No, its value is obtained by calling the standard getenv() function. You are effectively writing a function which replaces (or mirrors) the exec* functions ending in 'p' which, themselves, use the value of PATH to find the location of...
photo Re: main (all 5)
Fri 29th Oct 2021, 3:41am, Christopher M.
ANONYMOUS wrote: Please watch/listen to the final lecture recording. Each question will ask you to write just a function(s), or a *program* consisting of main() and one or more functions.
photo Re: main (all 5)
Thu 28th Oct 2021, 4:39pm, Christopher M.
ANONYMOUS wrote: In C, everything must be known (have been declared) before it can be used - functions, datatypes, variables... You can define main() before any functions that main() calls, but each of the functions must be declared (inside, or outside...
photo Re: #include (all 3)
Thu 28th Oct 2021, 4:37pm, Christopher M.
ANONYMOUS wrote: Please watch/listen to the recording of the last lecture.
photo Re: 2018 Sem 2 Question 2 (all 5)
Thu 28th Oct 2021, 4:36pm, Christopher M.
Yes - write the actual code. Watch/listen to the final lecture recording which explains that the marking of your syntax is not very strict. The word you want is 'pseudo', not 'sudo' (too much Linux? :-)
photo Re: Project 2 Sample Solution (all 4)
Thu 28th Oct 2021, 11:26am, Christopher M.
ANONYMOUS wrote: exam? - https://secure.csse.uwa.edu.au/run/help2002?hl=sample%20solution&a=902 - Likely
photo Re: about "manage" in exam 2020 4a (all 6)
Thu 28th Oct 2021, 4:44am, Christopher M.
ANONYMOUS wrote: Indeed. Environment variables are just stored in memory - all memory requried for the new process needs be copied/managed. Too casual to say 'PID also updated'. Which PID, did it exist and have a different value before? Yes. Sort of, but...
photo Re: 2018 Sem 2 Question 2 (all 5)
Thu 28th Oct 2021, 4:39am, Christopher M.
In hindsight a better wording would have been 'define a prototype and implement...' though no students queried it at the time.
photo Re: 2019 question 6a (all 5)
Thu 28th Oct 2021, 4:38am, Christopher M.
ANONYMOUS wrote: >> 1. for loop, sicne the loop instructions are often in same area in memory, it can What are 'loop instructions'? Don't be too casual with your language, be assertive to demonstrate what you understand - '...are often...' are they, or...
photo Re: 2018 Q2 (all 6)
Thu 28th Oct 2021, 4:34am, Christopher M.
ANONYMOUS wrote: ..... If you're allocating space for a pointer to 1 structure, returning a 'triple-pointer' to a char has to be wrong. Suggest also to initialise other fields in the structure. sheet must be a pointer. temp is only a single pointer (a string)...
photo Re: exam scope (all 5)
Thu 28th Oct 2021, 4:28am, Christopher M.
ANONYMOUS wrote: It's all important. From the Final Examination information page: "Questions may be drawn from material covered in lectures; from recommended reading (textbooks); from laboratory, workshop, and project work, and their sample solutions."...
photo Re: Hashfunction (all 3)
Thu 28th Oct 2021, 4:26am, Christopher M.
ANONYMOUS wrote: Any simple function is suitable, provided that it accepts a string as its parameter, and returns a non-negative integer as its result. A function simply summing the bytes in a string is sufficient.
photo Re: 2018 Q2 (all 6)
Wed 27th Oct 2021, 1:54pm, Christopher M.
ANONYMOUS wrote: Possible, but more difficult to deallocate (and will use more memory). An expanding 2D-array will be simplest to develop in an exam situation. Yes; bring your student card as access hours for labs and building may have changed.
photo Re: 2018 Q2 (all 6)
Wed 27th Oct 2021, 1:34pm, Christopher M.
ANONYMOUS wrote: A few things could be improved or corrected: - the whole spreadsheet should not be of a fixed 50x50 size, but be dynamically allocated, in each dimension, from a single (empty) point. e.g if someone adds an element to (4, 1000) the spreadsheet...
photo Re: Man page (both)
Wed 27th Oct 2021, 12:23pm, Christopher M.
ANONYMOUS wrote: What do you mean "the man page in c" ? There are no additional materials provided for the exam. All information here: https://teaching.csse.uwa.edu.au/units/CITS2002/examinations.php
photo Re: about "manage" in exam 2020 4a (all 6)
Wed 27th Oct 2021, 10:11am, Christopher M.
ANONYMOUS wrote: This forum really needs a sarcastic font.
photo Thoughts from a former CITS2002 student
Wed 27th Oct 2021, 4:43am, Christopher M.
Amitava and I fully understand that it's a stressful time of year - projects, deadlines, study, exams, results - it can feel overwhelming and, sometimes, the atmosphere gets a little adversarial. We appreciate that the material in this unit is new to many...
photo Re: about "manage" in exam 2020 4a (all 6)
Tue 26th Oct 2021, 1:20pm, Christopher M.
ANONYMOUS wrote: You have described a process ID, and an exit status - each could be stored in an integer. An OS surely needs to manage more than 2 integers when creating and 'tracking' the execution of processes?
photo Re: Hashtables in exam? (all 3)
Tue 26th Oct 2021, 5:44am, Christopher M.
ANONYMOUS wrote: They might appear in the exam, as could many other data-structures, including some that you may not have used/seen this year. If they are new (to this unit) they'll be described to you in the exam question. Such emphasis will be on your...
photo Re: Exam notes (all 6)
Tue 26th Oct 2021, 5:39am, Christopher M.
ANONYMOUS wrote: Please watch/listen to the final lecture recording. Suggest you don't make the font so small that you can't read it.
photo Re: 2020 Exam question 4A (all 4)
Mon 25th Oct 2021, 5:37pm, Christopher M.
ANONYMOUS wrote: You've mostly described (some) of the actions that the kernel performs, but the question asks for what information the kernel *manages* as this sequence of actions happens happen. (and, pedantically, you've described the delayed memory...
photo Re: Multiple command line arguments (all 6)
Mon 25th Oct 2021, 4:27am, Christopher M.
ANONYMOUS wrote: Can be in any order, and combined as in '-la' If you use getopt(), as strongly suggested, it will handle all such cases. There's good reasons we provide this information in lectures.
photo Re: Exam - #include (all 3)
Mon 25th Oct 2021, 4:26am, Christopher M.
ANONYMOUS wrote: Yes; strongly suggest that you watch the recording of the last lecture. There's good reasons we presented that lecture.

UWA week 42 - 2nd semester, week 12

photo Re: function names in the exam (all 4)
Sun 24th Oct 2021, 4:46pm, Christopher M.
ANONYMOUS wrote: I think that you're over-thinking it, perhaps introducing more stress than necessary. Exam markers are *really* looking for ways to give you marks, the last lecture (recording) should be telling you that. A well thought out answer will...
photo Re: Multiple command line arguments (all 6)
Sun 24th Oct 2021, 11:37am, Christopher M.
ANONYMOUS wrote: No contradictions there - the -a option only requests that 'dot' files are included in the set of files for consideration (with other options). May be; supporting them all will be almost zero additional effort.
photo Re: function names in the exam (all 4)
Sun 24th Oct 2021, 7:22am, Christopher M.
ANONYMOUS wrote: Exams are about demonstrating what you know so, clearly, providing as much correct information best answers the questions. But you suggested (common) approach is very good 'backup' if you don't know exact details, demonstrating that...
photo Re: Exam Notes (all 6)
Sun 24th Oct 2021, 6:48am, Christopher M.
ANONYMOUS wrote: Yes, though remember that this year's exam will not ask you to produce any diagrams.
photo Re: advanced solution -h/-f with hardlinks and multiple directories in arguments (all 3)
Fri 22nd Oct 2021, 3:12pm, Christopher M.
Perform all of your processing *after* getopt() has done its job, and found every argument. Then, ther will only be a single -h option (the last one provided), and work with that. No idea what you mean by 'the implied .' Yes.
photo Re: -A option clarification (both)
👏Fri 22nd Oct 2021, 2:47pm, Christopher M.
ANONYMOUS wrote: Just implement one version. Your choice.
photo Re: program's response with no options and arguments (all 8)
Fri 22nd Oct 2021, 2:46pm, Christopher M.
ANONYMOUS wrote: NO. The program must be given exactly one directory name (or one uploaded archive to the webpage. It *does not* have to automatically deal with the same directory of the program - unless you specifically requested that with the directory...
photo Re: program's response with no options and arguments (all 8)
Fri 22nd Oct 2021, 2:34pm, Christopher M.
ANONYMOUS wrote: Which doesn't sound like a problem to me. Why do you think this is a problem - it's running the program with no options, but with the (required) archive.
photo Re: program's response with no options and arguments (all 8)
Fri 22nd Oct 2021, 12:53pm, Christopher M.
ANONYMOUS wrote: What output does it give (and how did you execute it without completing any of the HTML forms for options or file-archive)? When I just press return in an empty 'options' box, it reports 'No archive uploaded' in red. ??
photo Project-2 REMINDERS
Fri 22nd Oct 2021, 12:50pm, Christopher M.
Please ensure that your name and student number are in at least one source-code file using the comment format on the project's question sheet. Ensure you add your partner's details too, if you worked with a partner. Only one person from each team needs...
photo Re: Are "." and ".." directories excluded for all command line options? (both)
Fri 22nd Oct 2021, 12:14pm, Christopher M.
ANONYMOUS wrote: This may help: https://secure.csse.uwa.edu.au/run/help2002?hl=dot%20dotdot&a=710 from the very first days of the project.
photo Re: program's response with no options and arguments (all 8)
Fri 22nd Oct 2021, 12:12pm, Christopher M.
ANONYMOUS wrote: All options are optional; executing without any options is valid.
photo Re: Option -m (all 5)
Fri 22nd Oct 2021, 12:11pm, Christopher M.
It would make sense to do it *after* the linking. The 'before' stats can always be generated in previous execution of the program, to decide whether it's worth linking things. Otherwise, it'd be too late!
photo Re: Sample solution gives incorrect values when given large sample set (all 3)
Fri 22nd Oct 2021, 10:59am, Christopher M.
Thanks James; yes, there's a known problem there (since earlier this week) which I'll get to when I have time.
photo Re: fina exam past papers (all 5)
Fri 22nd Oct 2021, 9:58am, Christopher M.
My motivations for not releasing sample exam solutions are: (many years ago, when I did release some solutions) students became 'obsessed' with those solutions, to the point of rote learning those answers, in the hope that those questions would be repeated...
photo Re: Option -m (all 5)
Fri 22nd Oct 2021, 4:54am, Christopher M.
ANONYMOUS wrote: Yes (should involve no extra work, just calling a function that you've already written, as the 'last thing' your program does before terminating).
photo Re: relative pathnames output (all 5)
Fri 22nd Oct 2021, 4:52am, Christopher M.
ANONYMOUS wrote: Yes, unfortunately we lost 26 hours of forum discussion, at this busy time. Then I lost Thursday, and my sanity. (discussed somewhere else) yes, you're taking the correct, simplest approach. Have the program produce its output in the 'form'...
photo Re: trouble with proper input for testing "-f" (both)
Fri 22nd Oct 2021, 4:46am, Christopher M.
ANONYMOUS wrote: You're not doing anything wrong. You can (have to) upload a single archived directory, but you cannot also upload a file for the -f option. Cannot be tested with the web-interface. Project Clarification, Oct 10th.
photo Re: does m support combination with flh? (all 3)
Fri 22nd Oct 2021, 4:44am, Christopher M.
ANONYMOUS wrote: Please read the very first Project Clarification which states what to do when multiple options are presented. Yes. If you are using getopt(), as strongly recommended, the parsing of the options is almost trivial (using code provided in lectures!),...
photo Re: Notes allowed for exam? (all 3)
Fri 22nd Oct 2021, 4:39am, Christopher M.
ANONYMOUS wrote: book? As reddish-pink square said - please read the exam information page: https://teaching.csse.uwa.edu.au/units/CITS2002/examinations.php and watch/listen to Tuesday's lecture recording.
photo Re: relative pathnames output (all 5)
Fri 22nd Oct 2021, 4:30am, Christopher M.
ANONYMOUS wrote: It's unclear what form of 'service' you believe is provided here.
photo Re: web sample solution (all 4)
Thu 21st Oct 2021, 7:13pm, Christopher M.
ANONYMOUS wrote: This is not something I can replicate. What sort of archive were you uploading? I guess that the files weren't all of zero size?
photo Re: web sample solution (all 4)
Thu 21st Oct 2021, 4:25pm, Christopher M.
ANONYMOUS wrote: It's now available again (sorry, a day of other emergencies today).
photo Re: Attempting only part of the advanced version? (both)
Mon 18th Oct 2021, 5:45pm, Christopher M.
A partial attempt is permitted.
photo Re: Sample solution output -h (all 4)
Mon 18th Oct 2021, 2:38pm, Christopher M.
I believe it's corrected now. ??
photo Re: Sample solution output -h (all 4)
Mon 18th Oct 2021, 2:09pm, Christopher M.
Will look at it soon. It's related to another reported problem of not counting files correctly.

UWA week 41 - 2nd semester, week 11

photo A Clarification on self-referential structures and hashtables
Sun 17th Oct 2021, 6:37pm, Christopher M.
Prof. Datta has prepared a short document explaining self-referential structures and code related to hashtables. The document should be of most benefit to students who have not taken CITS2200 Data Structures and Algorithms. See the 2nd project's Clarifications...
photo Re: Initialise Hashtable (both)
Sun 17th Oct 2021, 7:29am, Christopher M.
Hello Karam, Your question doesn't quite make sense to me (or it's incomplete). To initialise something (i.e. initially, before it's to be used) you need to identify *what* the possible initial value is. Usually it's a value that means "an impossible value...
photo Re: open directory (both)
Sat 16th Oct 2021, 4:55pm, Christopher M.
ANONYMOUS wrote: The latter.
photo Re: x11 linux recursion error (all 4)
Sat 16th Oct 2021, 4:13pm, Christopher M.
Interesting, thanks for the reference. I don't believe that it's a special case. It's simply a symbolic link to itself, and could be (maliciously?) created anywhere. On my Ubuntu 21.10 installation it's /usr/bin/X11 (capital 'X') Unfortunately, you...
photo Re: freeing memory (both)
Sat 16th Oct 2021, 8:34am, Christopher M.
ANONYMOUS wrote: No, not required. There's also little point for this type of program: - all of the dynamically allocated memory is probably required until just before the program terminates, - when the program terminates, the OS will deallocate all memory...
photo Re: Marks for project 1 (all 10)
Sat 16th Oct 2021, 8:29am, Christopher M.
ANONYMOUS wrote: Have you looked at your project's feedback (click the Feedback icon, below the histogram, in csmarks?) You may also download and modify the marking script to investigate why particular automated tests may have been unsuccessful.
photo Re: different file count on sample solution (both)
Sat 16th Oct 2021, 8:28am, Christopher M.
Will look into it.
photo Re: calling multiple flags (both)
Fri 15th Oct 2021, 6:55pm, Christopher M.
https://teaching.csse.uwa.edu.au/units/CITS2002/projects/project2-clarifications.php
photo Re: Option -l clarification (both)
Fri 15th Oct 2021, 5:19pm, Christopher M.
What does the sample solution do?
photo Re: Removing files ending with "~" (all 3)
Fri 15th Oct 2021, 5:05pm, Christopher M.
ANONYMOUS wrote: There is nothing special about those files, as far as the OS is concerned. Some editors choose to make a copy of a file before editing, and just append the '~' character to its name. Other editor may take different approaches, or place...
photo Re: implicit declaration of function getopt (both)
Fri 15th Oct 2021, 5:02pm, Christopher M.
Which header file are you using? On both Linux and macOS, including <getopt.h> works.
photo Re: External header-only libraries (both)
Fri 15th Oct 2021, 4:53pm, Christopher M.
ANONYMOUS wrote: structures Much preferred that you submit work that you have actually written yourself. The request seems strange, given that you've been provided with code for an appropriate data-structure in one of our Workshops, which you can freely...
photo Re: x11 linux recursion error (all 4)
Fri 15th Oct 2021, 3:21pm, Christopher M.
Was expecting someone to say "cool story bro'" What is the full pathname of that 'x11' thing? I don't seem to have anything similar on my Ubuntu 21.04.
photo Re: Hashtable question (both)
🤓Fri 15th Oct 2021, 1:16pm, Christopher M.
A good, relevant, question, but one for you to solve.
photo Re: Header Files (both)
Fri 15th Oct 2021, 12:55pm, Christopher M.
ANONYMOUS wrote: If this is one of your header files then, yes, the file only needs declare functions that are needed by your own C source files. Providing any additional declarations provides no benefit, and doesn't modify any of the object or executable...
photo Re: Option -f (all 3)
Fri 15th Oct 2021, 9:07am, Christopher M.
ANONYMOUS wrote: All files may reside anywhere: https://secure.csse.uwa.edu.au/run/help2002?p=np&a=803&all=y7
photo Re: What files to consider (all 7)
Thu 14th Oct 2021, 1:37pm, Christopher M.
But it's not ALL FILES ON YOUR COMPUTER, just all files in/below the indicated directory (just a subset of all your files).
photo Re: What files to consider (all 7)
Thu 14th Oct 2021, 1:25pm, Christopher M.
ANONYMOUS wrote: You DO NOT need to scan through all files on your computer, unless you specifically request all files by providing '/' as the program's final argument (unsure where you have obtained this idea).
photo Re: strSHA2.c "undefined reference to 'main' " issue when compiling (all 3)
Thu 14th Oct 2021, 1:16pm, Christopher M.
Hello, strSHA2.c is not a complete program, it just contains some functions, but does not have a main() function. It will need to be compiled (using -c) and linked with all your other files (guessing that just your duplicates.c has a main() function)....
photo Re: What files to consider (all 7)
Thu 14th Oct 2021, 4:29am, Christopher M.
ANONYMOUS wrote: All possible files, from anywhere. "Hmmm, I wonder if this strange file named 'project.c' was backed up on Monday, perhaps under a different name?" /home/chris/bin/duplicates -f unknown/project.c /home/chris/backups/monday
photo Re: StrSHA2 (all 4)
Thu 14th Oct 2021, 4:23am, Christopher M.
ANONYMOUS wrote: our Let's not induce anything. Simply add the role of strSHA2.c to your Makefile, as you have for each of the other source files you have written.
photo Re: No access to files in other directories other than current working directory (all 4)
Wed 13th Oct 2021, 6:03pm, Christopher M.
ANONYMOUS wrote: That I don't know, but it's certainly essential to name the file correctly.
photo Re: No access to files in other directories other than current working directory (all 4)
Wed 13th Oct 2021, 5:37pm, Christopher M.
ANONYMOUS wrote: I strongly doubt that this is the case. Can you print the value of strSHA2( "/bin/bash" ); and does it have the same value as: shasum -a 256 /bin/bash ??
photo Re: StrSHA2 (all 4)
Wed 13th Oct 2021, 1:34pm, Christopher M.
ANONYMOUS wrote: You have the source code, and the strSHA2() function should be easy to read. It can only return NULL in 2 cases: - it cannot open, for read access, the requested file (likely), or - it cannot allocate 65 bytes of memory (unlikely).
photo Re: Project 2 data structure efficiency (all 4)
Wed 13th Oct 2021, 5:33am, Christopher M.
with Hi Jonathan, It could also be that you're testing with quite large files, perhaps large data or videos. The speed of SHA2 is linear in the size of its input (and unrelated to what that actual input is). The following test program times the execution...
photo Re: Make link broken (both)
Tue 12th Oct 2021, 7:22pm, Christopher M.
ANONYMOUS wrote: Thanks for reporting the problem (now fixed). The link is, however, not to the make program, but to the standard documentation about make: https://teaching.csse.uwa.edu.au/units/CITS2002/resources/make.html
photo Re: Regarding marking project 2 (both)
Tue 12th Oct 2021, 7:10pm, Christopher M.
ANONYMOUS wrote: Similar to the reasoning here: https://secure.csse.uwa.edu.au/run/help2002?p=np&a=791 using a 'smarter' data-structure than basic arrays is *much* preferred, and a more appropriate choice for Project-2.
photo Re: Project 2 data structure efficiency (all 4)
Tue 12th Oct 2021, 7:07pm, Christopher M.
Hi Jonathan, We do need to set some time-limit when marking projects, because there genuinely are some project submissions that do get stuck in infinite loops. In the case of the 1st project, even 10 seconds in an *enormous* amount of time for the quite...
photo Project-1 marks available - UPDATED
Tue 12th Oct 2021, 3:00pm, Christopher M.
Your Project-1 marks are now finally available. You should be able to see your mark /50 (contributing 25%) in csmarks, and be able to download your feedback sheet by clicking on an icon below the histogram. The average mark of all 284 submitted projects...
photo Re: Final Exam (both)
Tue 12th Oct 2021, 11:28am, Christopher M.
ANONYMOUS wrote: Final details are available from here: https://teaching.csse.uwa.edu.au/units/CITS2002/examinations.php (have just removed word the 'Preliminary') You can find past exam papers via the Library website - search OneSearch for CITS2002 They...
photo Re: Hidden Files (both)
Tue 12th Oct 2021, 10:59am, Christopher M.
ANONYMOUS wrote: Yes, they're often annoying! They (should only) appear when using macOS and archiving your files with tar. They are Apple's way of storing extra in-file-system attributes (metadata), so that the set of possible attributes can be expanded...
photo Re: Modifying strSHA2.c (all 4)
Tue 12th Oct 2021, 4:24am, Christopher M.
I can't imagine what problems those might be, but your choice. While the returned value is a string, it's always a fixed size, and space for it is already dynamically allocated.
photo Re: POSIX PROJECT 2 (both)
Mon 11th Oct 2021, 2:06pm, Christopher M.
The preferred constant is MAXPATHLEN, declared in <sys/param.h> Does not have a required numeric value, it's system- (actually file-system) dependent - it's only 1024 on macOS's AFS+. For this project, no need to check against this limit - will alwsys...
photo Re: Usage (both)
Mon 11th Oct 2021, 11:32am, Christopher M.
ANONYMOUS wrote: Suggest that you try the sample solution, and review a few online manual entries for keywords such as 'usage' and 'synopsis'. No, nothing to do with these points. It's a detailed error 'report', issued because the program can't commence...
photo Re: Marks for project 1 (all 10)
Mon 11th Oct 2021, 11:31am, Christopher M.
ANONYMOUS wrote: There's no need to keep asking; doing so doesn't speed up the process, and you'll be well informed when they're available. You won't miss them.
photo Re: Debugging make files (all 6)
Mon 11th Oct 2021, 3:53am, Christopher M.
That's great; good luck,

UWA week 40 - 2nd semester, week 10

photo Re: Modifying strSHA2.c (all 4)
Sun 10th Oct 2021, 6:06pm, Christopher M.
somewhere? Yes, but make sure that you submit your modified version and (to be safe) add a good comment explaining your change. But interested what you need to modify, and why??
photo Re: #define(ing) functionality vs declaring a function (all 3)
Sat 9th Oct 2021, 6:45pm, Christopher M.
Hi Travis, Well you're almost there in answering your own question - write a small test program that checks a pointer using the macro version and then the function version, and observe the differences (though you'll need to fix the syntax of your function...
photo Re: typos in project outline (both)
Sat 9th Oct 2021, 6:40pm, Christopher M.
Thanks. Great work :-)
photo Re: Project 2 Advance Task 2 (both)
Sat 9th Oct 2021, 11:10am, Christopher M.
No. If -A is provided, the program quickly exits. And "For the basic project, the "starting" directory will only contain regular files and sub- directories. In particular, there will be no hard- or symbolic-links."
photo Re: Headers (all 6)
Sat 9th Oct 2021, 6:03am, Christopher M.
It's important to use the correct words to discuss problems (why I try to be very consistent (pedantic?) in class-sessions and on this forum). Firstly, we do not *define* functions in header files. The header files only *declare* the functions, where *declare*...
photo Re: Debugging make files (all 6)
Sat 9th Oct 2021, 5:29am, Christopher M.
Hello Jonathan, Just Chris. You (still) haven't really described what the bugs are - whether you're just describing a single error that now occurs due to a recent change to your code, or a specific bug that only occurs for some types of input data (the...
photo Project 2 - sample solution available
Fri 8th Oct 2021, 1:30pm, Christopher M.
There is now a web-based application: https://secure.csse.uwa.edu.au/run/duplicates that runs the project's sample solution and displays its output via the webpage. [and still a bit of a work in progress] You may select between the basic and advanced sample...
photo Re: Debugging make files (all 6)
Fri 8th Oct 2021, 4:04am, Christopher M.
Hi Jonathan, Your Makefile is a textfile that provides the configuration for each execution of the make command. I do not know if VSC attempts to understand and perform the commands requested in the Makefile, or if it executes the native 'make' command...
photo Re: Do we include . and .. when using -a command option (both)
Fri 8th Oct 2021, 3:55am, Christopher M.
ANONYMOUS wrote: dot and dot-dot are not files. It's unclear why you are mentioning running ls ??
photo A disturbing IT advance(?) for society
Thu 7th Oct 2021, 6:23pm, Christopher M.
Printers where you don't even own the ink, and have to subscribe to a per-month ink plan: "HP+ requires an HP account, ongoing internet connection and use of Original HP Ink cartridges to operate" https://www.hp.com/au-en/shop/hp-deskjet-2720e-all-in-one-printer-297w8a.html...
photo Re: Marks for project 1 (all 10)
Thu 7th Oct 2021, 3:36am, Christopher M.
A *rough* idea is later today or tomorrow.
photo Re: Command-line options order (both)
Wed 6th Oct 2021, 11:33am, Christopher M.
significantly. The directory pathname will always be (tested as) the last command-line argument, after any options. The differences you've described 'appear' when people use either hand-written code, or the standard getopt() library function (under Linux)....
photo Re: Lecture-10 execlp() (both)
Tue 5th Oct 2021, 5:39pm, Christopher M.
ANONYMOUS wrote: Thanks for reporting this - both poorly worded and poorly formatted! Changes now made: https://teaching.csse.uwa.edu.au/units/CITS2002/lectures/lecture10/08.html
photo Re: link() and unlink() (both)
Mon 4th Oct 2021, 2:06pm, Christopher M.
ANONYMOUS wrote: No. There is (still) only one 'file', containing the original data, but now 2 links, 2 names, for that same file. Play with the 'ls' utility program, and you'll notice that when you modify one of those links, the other changes too. Try it....
photo Re: Project 2 list of questions (all 5)
Mon 4th Oct 2021, 12:23pm, Christopher M.
Bit confused by your wording. The indicated file could be anywhere in the filesystem; you don't need to find it as you're given its name/location. It may not be below the directory you are scanning. ?? It means print 4 lines, one integer per line, in...
photo Re: Skeleton for project 2 (both)
Mon 4th Oct 2021, 12:05pm, Christopher M.
No. But you do have a lengthy list of suggested steps that lead to a solution.

UWA week 39 - 2nd semester, week 9

photo 1st project: sample solution and your survey feedback
Sun 3rd Oct 2021, 7:40pm, Christopher M.
Thanks to those who completed the short survey after our 1st project. You may see the results and other students' verbatim comments here: https://teaching.csse.uwa.edu.au/units/CITS2002/feedback/2021/project1-feedback/ (with my personal comments in blue)....
photo Re: Listing files (both)
Sun 3rd Oct 2021, 6:15pm, Christopher M.
ANONYMOUS wrote: No, don't do that. If a person invokes (any) program with ../Project2/duplicates.c don't confuse them by reporting an alternate name. Not required, but if you ever need to, the helpful function is realpath(), a POSIX function, not a system...
photo Re: Project 2 list of questions (all 5)
Sun 3rd Oct 2021, 2:31pm, Christopher M.
No. The code of a sample solution after the deadline. If I have time this week (and that's a big IF) I'll write a webpage that allows you to upload a directory of files (as a Zip file), and it'll run the sample solution on that directory. But it's a busy...
photo Re: Reusing/copying code (both)
Sun 3rd Oct 2021, 2:19pm, Christopher M.
ANONYMOUS wrote: Yes, that's what they're provided for (and don't forget lab solutions). If not concerned with efficiency (which we're not), for most of those code segments there's no significantly better or simpler way to write such frequently seen sequences...
photo Re: Project 2 Directory Files (both)
Sun 3rd Oct 2021, 4:20am, Christopher M.
ANONYMOUS wrote: Yes, the directory entries dot and dot-dot were discussed in Workshop-8, and dealing with them correctly is an important responsibility of your project. Consider the execution of the comamnd ls -lR
photo Re: Proj 1 sample solutions (both)
Sat 2nd Oct 2021, 7:40am, Christopher M.
The final submissions from students with extensions, are due on Sunday, so the sample solution will be available on Monday.
photo Re: Makefile (all 4)
Sat 2nd Oct 2021, 7:37am, Christopher M.
It looks like, either: - you do not have a C file that defines the main() function, or - you're not compiling or linking that file into your executable. Also, note that this project requires you to use the -pedantic compilation option.
photo Re: strdup compilation (all 4)
Sat 2nd Oct 2021, 7:34am, Christopher M.
Your project will be compiled using your submitted Makefile, so your approach will work. The question of *how* to declare strdup() is a good (and common) question, for which there's truely correct or portable answer. Your solution relies on the knowledge...
photo Re: Combined Options (all 4)
Sat 2nd Oct 2021, 7:07am, Christopher M.
ANONYMOUS wrote: ones I think my previous answer now answers your question. Note that, in your example, you're requesting files with a hash value of "-f" (which is probably not what you're wanting).
photo Re: Combined Options (all 4)
Sat 2nd Oct 2021, 7:04am, Christopher M.
Hi Alvaro, For some of the combinations, there'll be an execution sequence that 'are logical' in the context of what the options request, and for other combinations there'll be no logical sequence - there'll just be the one that's implemented. There's...
photo Re: Project 2: Makefile & testing (all 3)
Fri 1st Oct 2021, 2:02pm, Christopher M.
Hello Ninmar, To avoid me first paraphrasing a lot of existing material, may I ask if you've downloaded and tried the 'make' example from Lecture-17 and, if still unclear, what about it is still unclear? There's whole books of advice, and good practice,...
photo Project-2 is available
Thu 30th Sep 2021, 3:07pm, Christopher M.
Project-2 is available from: https://teaching.csse.uwa.edu.au/units/CITS2002/projects/project2.php Please post requests for clarification about any aspect of the project to help2002 so that all students may remain equally informed. If necessary, the main...

UWA week 38 - 2nd semester, week 8

photo Re: Question about labsheet4 (both)
Sat 25th Sep 2021, 4:32am, Christopher M.
ANONYMOUS wrote: (firstly, congratulations on not asking a Project question! :-) It's not guaranteed, but I'm guessing that you're calling the function with: strcat_a(argv[1], argv[2]); ??? If so, you need to look at how much memory (its length) is being...
photo Re: Ackermann-deep (both)
Fri 24th Sep 2021, 2:56pm, Christopher M.
ANONYMOUS wrote: Yes, quite reasonable (obviously, just depends on age+cost of machine). https://secure.csse.uwa.edu.au/run/help2002?p=np&a=527&all=y2
photo Re: Project 1; When is data written to main memory (both)
Fri 24th Sep 2021, 12:01pm, Christopher M.
ANONYMOUS wrote: This is really a 'big' question that has been well discussed in this forum, and you should be consulting past discussions and (more importantly) a textbook on the topic.
photo Re: Project questions on implementing cache hits/misses (all 6)
Fri 24th Sep 2021, 4:04am, Christopher M.
Hi Joseph, There's a number of posts, and the Clarification of 10th Sept, that states why getting the identical statistics is not essential. Yes, both of those are correct; you'll also need to set/reset the dirty bit, else you may be unnecessarily writing...
photo Today's Students Don't Understand the Basics of Computer Operations
Fri 24th Sep 2021, 1:23am, Christopher M.
The title taken from a post today on Slashdot: https://it.slashdot.org/story/21/09/23/163212/todays-students-dont-understand-the-basics-of-computer-operations summarising an article in The Verge: https://www.theverge.com/22684730/students-file-folder-directory-structure-education-gen-z...
photo Students seeking Project-2 partners (all 30)
Thu 23rd Sep 2021, 3:22pm, Christopher M.
As for the 1st project, the 2nd project may be completed individually or in teams of two (but not teams of three). The choice of project partners is up to you - you will not be automatically assigned a project partner. So, get in quick.....
photo Preliminary information about Project-2 and the Final Exam
Thu 23rd Sep 2021, 3:12pm, Christopher M.
Hello Everyone, (lots of early questions from students, so...) You may find some preliminary information about Project-2 and the Final Exam from: https://teaching.csse.uwa.edu.au/units/CITS2002/projects/project2.php and https://teaching.csse.uwa.edu.au/units/CITS2002/examinations.php...
photo Re: Project questions on implementing cache hits/misses (all 6)
Thu 23rd Sep 2021, 12:57pm, Christopher M.
ANONYMOUS wrote: Hi, I'm afraid that I still don't know what the problem is that you're facing; just sounds like "everything to do with caches". There are, of course, many discussions on here about caches (in fact most, as it's the biggest challenge of...
photo Re: Project questions on implementing cache hits/misses (all 6)
Thu 23rd Sep 2021, 4:37am, Christopher M.
ANONYMOUS wrote: Hi, I'm a little confused by what your question is asking. If you have implemented reading and writing using a cache, you only need to increment integer variables to count the hits and misses. In the starting code: https://teaching.csse.uwa.edu.au/units/CITS2002/projects/runcool.c...
photo An update on the 1st project
Tue 21st Sep 2021, 1:50pm, Christopher M.
An update on the 1st project, as some students are asking about some of these matters. To date (still some students with approved extensions) we have 173 project submissions, of which 87 were from students working in pairs. (as is typical) about 15% were...
photo Re: prints confusion (all 5)
Mon 20th Sep 2021, 6:35am, Christopher M.
Hello Joseph, Before trying "ab", did you first try the empty string "", and then "a", to see how their data representation 'evolves' as the related strings get longer?
photo Re: cool C webpage compiler issue with #include syntax (all 4)
Mon 20th Sep 2021, 6:23am, Christopher M.
Hello Cooper, You do not upload your C program (with suffix .c) to the webpage. You upload your cool programs (with suffix .cool), and then download coolexe files. You develop, compile, and test your runcool.c program on your own computer. I suggest that...

UWA week 37 - 2nd semester, week 7

photo Re: Fast-jeq in statistics (both)
Sun 19th Sep 2021, 5:02pm, Christopher M.
I suggest that you contact someone able to make the small change necessary.
photo Re: cool C webpage compiler issue with #include syntax (all 4)
Sat 18th Sep 2021, 7:35pm, Christopher M.
Please see: https://secure.csse.uwa.edu.au/run/help2002?hl=syntax&a=356
photo Re: Returning 0 writes on some files with cache (both)
Fri 17th Sep 2021, 6:38pm, Christopher M.
ANONYMOUS wrote: As you've stated, you're observing these zero writes on very small (unrealistic) programs that all fit in cache and perform few, if any, memory updated without looping. Won't happen when marking.
photo Re: Writing to main memory from cache (all 10)
Fri 17th Sep 2021, 6:36pm, Christopher M.
ANONYMOUS wrote: Simplicity, and real costs. Please see my just-previous waffly post :-)
photo Re: Writing to main memory from cache (all 10)
Fri 17th Sep 2021, 6:35pm, Christopher M.
ANONYMOUS wrote: We have not been focusing on speed at all in this project. And here's why: It is false economy to worry about about 10-20 writes to memory, in a program that makes billions of memory accesses. Neither you nor I (or the project) are measuring...
photo Re: Extra statistics keep or remove? (both)
Fri 17th Sep 2021, 1:23pm, Christopher M.
ANONYMOUS wrote: From the apparently impossible to understand PROJECT DESCRIPTION: "During the project marking, all lines other than those presenting the required statistics, or printed by the cool program itself, will be ignored."
photo Re: suggestions for figuring out direct mapping (cache) (all 4)
Fri 17th Sep 2021, 1:22pm, Christopher M.
ANONYMOUS wrote: One is a many-to-one-mapping; the other is a one-to-many-mapping. Should not require much thought, and you may have already solved it in your question. (politely, because it's Friday) you may be bad at math(s), if you believe that a lack...
photo Re: Submission file (both)
Fri 17th Sep 2021, 1:14pm, Christopher M.
ANONYMOUS wrote: Sometimes I question my own writing ability! From THE PROJECT DESCRIPTION: "Your project must be written in C11 in a single source-code file named runcool.c This is the only file you should submit for marking."
photo Re: suggestions for figuring out direct mapping (cache) (all 4)
Fri 17th Sep 2021, 5:06am, Christopher M.
ANONYMOUS wrote: Very close. Imagine that you have 100 main-memory locations, but just 10 cache locations, so that every 10th main location has to be mapped to the same cache location: (0, 10, 20...) -> 0 (1, 11, 21...) -> 1 .... See any pattern there?...
photo Re: Writing to main memory from cache (all 10)
Fri 17th Sep 2021, 5:02am, Christopher M.
ANONYMOUS wrote: That's correct; so you'd have to careful that, if you write it 'back' to main memory, that you write it somewhere that wouldn't result in any future actions being incorrect (i.e. will not do any damage). One possibility would be to have...
photo Re: popr functionality clarification (all 8)
Thu 16th Sep 2021, 5:28pm, Christopher M.
ANONYMOUS wrote: be ? Please experiment with it, rather than seeking an answer from someone else.
photo Re: popr functionality clarification (all 8)
Thu 16th Sep 2021, 5:25pm, Christopher M.
right ? This past answer is applicable: https://secure.csse.uwa.edu.au/run/help2002?hl=experiment&a=324 Good luck,
photo Re: popr functionality clarification (all 8)
Thu 16th Sep 2021, 3:49pm, Christopher M.
ANONYMOUS wrote: Yes; the intended destination is *relative* to the FP.
photo Re: trouble when testing with akermann (both)
Thu 16th Sep 2021, 3:48pm, Christopher M.
ANONYMOUS wrote: Politely, if you can't determine the problem when examining the code, it's difficult for anyone to do better without examining the code (but don't post it).
photo Re: Cache Questions (all 8)
Thu 16th Sep 2021, 3:46pm, Christopher M.
ANONYMOUS wrote: This is not a definitive answer, not designed to be exactly replicated, but if you have functions like read_memory() and write_memory(), have them print out what they're accessing. For the whole execution of basic.cool I see: READ 0 READ...
photo Re: Cache Questions (all 8)
Thu 16th Sep 2021, 3:27pm, Christopher M.
ANONYMOUS wrote: It's always the addresses, never the numeric values held in any addresses. Instructions like CALL and RETURN involve/manipulate the stack (which is in memory) and if CALL pushes something onto the stack, and it's still there when you RETURN,...
photo Re: Cache Questions (all 8)
Thu 16th Sep 2021, 2:58pm, Christopher M.
ANONYMOUS wrote: (now I'm confused, perhaps by your wording...) By *data* do you mean: - the *numeric value* of a data item, or - the memory address that just happens to be storing data ?? The mapping to and from cache locations <-> main-memory locations is...
photo Re: cache misses (both)
Thu 16th Sep 2021, 1:57pm, Christopher M.
Suggest that you check the proj. description again. Cache misses occur on reads, not writes.
photo Re: Increment operator inline (both)
Thu 16th Sep 2021, 1:54pm, Christopher M.
ANONYMOUS wrote: No problems - almost anticipated that most students will do this. No (you earn marks, not lose them). For C programmers, reading C code, it's very clear what's going on. The only 'danger' that may arise is if the read_memory() function,...
photo Re: Cache Questions (all 8)
Thu 16th Sep 2021, 4:22am, Christopher M.
ANONYMOUS wrote: Indeed, it can be. The description is unlikely to be bloated (in a textbook), it'll be relevant (for what's it's describing), just a lot of it. Textbooks really are great; sadly the desire to find quick solutions from only on the first...
photo Re: Marking (all 4)
Thu 16th Sep 2021, 4:10am, Christopher M.
ANONYMOUS wrote: Your question is too difficult to answer definitively. You receive marks, for implemented instructions and cache, both by manual inspection and running against some tests (automatically), so you can earn marks for things that don't completely...
photo Re: Writing to main memory from cache (all 10)
Thu 16th Sep 2021, 4:05am, Christopher M.
>> When do I have to write it back to the main memory? Is it only when I read/write If a cache location needs to be used to hold a new value, and its current value is not currently reflected in main-memory, then the current values needs to be written-back....
photo Re: Printing instructions in the project (both)
Wed 15th Sep 2021, 1:05pm, Christopher M.
ANONYMOUS wrote: It was never 'in' - it was commented out in the starting code.
photo Re: Implementation of Cache, Pointers Necessary? (both)
Wed 15th Sep 2021, 11:52am, Christopher M.
Pointers definitely not required. The 1st project is designed so that it can be successfully coded with all the 'tools' presented by date of the project's release. If unsure about how to start, or how to have multiple main memory locations associated with...
photo Re: n_main_memory_writes significantly higher (and what is fast-jeq) (all 5)
Wed 15th Sep 2021, 8:33am, Christopher M.
ANONYMOUS wrote: Perhaps think of it as "if a cache memory location is modified, then the previous value in that location may first need to be written back to main memory". Other than on program termination, we can't afford to lose knowledge that any value...
photo Re: making registers variables (PC, SP, FP) global (all 4)
Wed 15th Sep 2021, 4:07am, Christopher M.
ANONYMOUS wrote: The problem with global variables is that *any* function that can see them, can possibly accidentally modify them. Not just my judgement; that of millions of far better programmers than me, over the past 60 years. It's not really "a C thing",...
photo Re: calling and returning (both)
Tue 14th Sep 2021, 7:19pm, Christopher M.
ANONYMOUS wrote: Are you setting/modifying the PC, to indicate where the next instruction (main's 1st instruction) comes from? The HALT is there to stop the whole program, once control has returned from main().
photo Re: No Mid-Sem Test right? (all 5)
Tue 14th Sep 2021, 7:15pm, Christopher M.
Thanks for showing that; I haven't seen it. That's actually the wording from last year (when we last had a MST). I think some of the wording 'rolls over' each year, and is described as 'indicative assessment'. Will see if it can be changed. No MST this...
photo Re: n_main_memory_writes significantly higher (and what is fast-jeq) (all 5)
Tue 14th Sep 2021, 3:53pm, Christopher M.
REALLY wish that you didn't disclose so much detail about your design: https://secure.csse.uwa.edu.au/run/help2002?hl=akin&a=379 Was there actually a question?
photo Re: Printing Statistic Exit (both)
Tue 14th Sep 2021, 2:15pm, Christopher M.
ANONYMOUS wrote: Printing not required (and will be ignored). When testing, we'll use the true exit status of your runcool program, not the suspicious value that it prints out! :-)
photo Re: Main Memory Writes with Cache (both)
Tue 14th Sep 2021, 2:14pm, Christopher M.
execute. Yes, of course. Instructions are held in memory, and can only be fetched, by the CPU, as going through the cache. Why do all that (expensive, slow) work mutliple times. Rare occasions? Review Lecture-12, and consider what is required when a programs...
photo Re: Main memory reads not showing on coolc website when uploading own file (all 5)
Tue 14th Sep 2021, 11:46am, Christopher M.
Not convinced of your last sentence. But, onwards....
photo Re: Halting at the begining (all 6)
Tue 14th Sep 2021, 10:35am, Christopher M.
What is 'it' ? Is a function returning 0 to indicate success, or returning zero to indicate that that's how many things it did for you? Check the on-computer manual entry for the function to find out what the zero means.
photo 3 free programming eBooks
Tue 14th Sep 2021, 7:18am, Christopher M.
For those of us that collect 'em, but never read 'em :-) https://www.fanatical.com/en/bundle/international-day-of-the-programmer-bundle-giveaway
photo Re: making registers variables (PC, SP, FP) global (all 4)
Tue 14th Sep 2021, 6:31am, Christopher M.
ANONYMOUS wrote: Generally not advised (in any programming) unless required so, yes, if not necessary will affect marking. (suspecting why you're asking) if you have time, you may like to investigate C pre- processor macros.
photo Re: Output accuracy (all 10)
Tue 14th Sep 2021, 6:27am, Christopher M.
Thanks for your understanding heart-on-my-sleeve response Ninmar. We hear back from a number of later year students and graduates who confess to loathing CITS2002 while doing it but, in later units and work, appreciate it more.
photo Re: Marking (all 4)
Tue 14th Sep 2021, 6:15am, Christopher M.
ANONYMOUS wrote: (dislike these last-minute questions) The use of main-memory without a cache is trivial - hopefully you're seen that both reading an writing are just 2-3 lines each. Not many marks there. But having correct access to main memory without...
photo Re: Return function (all 3)
Tue 14th Sep 2021, 6:08am, Christopher M.
ANONYMOUS wrote: If the coolc code generation needs to adds an implicit return statement it will, but the returned value will just be whatever is on TOS at the time. There's no anticipated value - it will depend on what the program has previously done....
photo Re: Halting at the begining (all 6)
Tue 14th Sep 2021, 6:04am, Christopher M.
A core message in this unit is that system-calls and the functions from the standard-library fairly consistently return a value, either indicating their success or failure for a specific reason. All programs should capture and test these return values,...
photo Re: Restoring control registers when returning - factorial.coolexe (all 3)
Tue 14th Sep 2021, 6:00am, Christopher M.
ANONYMOUS wrote: The returned value of a function needs copying into a location relative to the FP. It seems that you've already modified FP before copying the RV and changing SP. I hope that you laughed, and not cried, when you first saw this output (I...
photo Re: Main memory reads not showing on coolc website when uploading own file (all 5)
Tue 14th Sep 2021, 5:51am, Christopher M.
ANONYMOUS wrote: It's working for me, and no-one else is reporting it as a problem. Each statistic must be reported on its own line, so I suspect that your program prints something (integer or string) which is not followed by a newline character "\n".
photo Re: Cant upload to compiler/dont have permission to use shell (both)
Tue 14th Sep 2021, 5:49am, Christopher M.
Hello James, Two possible problems and suggestions: - the file holding your cool program requires the suffix '.cool', not '.txt' - you have not downloaded a shell, but s shallscript (a file of shell commands). Before you can execute the shsllscript, you'll...
photo Re: Output accuracy (all 10)
Mon 13th Sep 2021, 6:31am, Christopher M.
Hello Ninmar, Thanks for your comment, and I'll state that I respect that you've posted your criticisms and have been willing to put your name to them, rather than posting anonymously. Here's another thing (perspective). This is a second-year unit (yes,...
photo Re: main memory writes statistics and caching (all 3)
Mon 13th Sep 2021, 4:50am, Christopher M.
ANONYMOUS wrote: Hi, I'm not quite sure what changes you've made, but it sounds like you're sort of "cheating" if you're trying to determine what elements of memory are being used for (instructions or data). The CPU and memory don't know what the memory...
photo Re: prints confusion (all 5)
Mon 13th Sep 2021, 4:29am, Christopher M.
I trust that you've read the other thread: https://secure.csse.uwa.edu.au/run/help2002?p=np&a=397&all=y12 (and am thus unsure why you've started another one. You'll have 'no chance' of decoding '26144 25441 28532 26994 27745 26912 8307' so, like most problems...
photo Re: Project 1 - About the operation to be performed by "return" (both)
Mon 13th Sep 2021, 4:23am, Christopher M.
Not sure I understand your question. If memory holds a program consisting of multiple functions, then the code for each function will have (at least one) RETURN instruction - the instructions for the second function will naturally follow the RETURN of...
photo Re: problems with negative arithmetics (both)
Mon 13th Sep 2021, 4:15am, Christopher M.
ANONYMOUS wrote: Your explanation is slightly incorrect - the order of arithmetic, actually the precedence of the operators *is* (dir or mult) before (add or sub). The same as nearly every other programming language. The problem/error you're seeing is...

UWA week 36 - 2nd semester, mid-semester break

photo Lecture schedule updated
Sun 12th Sep 2021, 5:36am, Christopher M.
(we've just realised that) Monday 27th September is a public and UWA holiday, so there will be no lecture or laboratories held that day. The unit schedule: https://teaching.csse.uwa.edu.au/units/CITS2002/schedule.php has been updated to reflect this, ...
photo Re: Write allocate or No-write allocate (both)
Sat 11th Sep 2021, 7:25am, Christopher M.
ANONYMOUS wrote: It's an interesting question, you must have been reading widely, but one that doesn't make much sense (have a more-correct answer in the context of our project): - our project doesn't employ multi-word cache lines. - our programs will not...
photo Re: prints instruction (all 12)
Sat 11th Sep 2021, 7:11am, Christopher M.
ANONYMOUS wrote: The character datatype in C11 is only 8-bits wide, so it can store values in the range 0..255 (2^8 - 1). You cannot 'convert' the (larger) integer 25441 into a small integer with only 8- bits - clearly some of the information must be...
photo Re: Main function return difference (both)
Sat 11th Sep 2021, 7:03am, Christopher M.
Have a look at the bottom of the code developed in Workshop-4: https://teaching.csse.uwa.edu.au/units/CITS2002/workshops/stackmachine-soln.c Then review the end of Lecture-10.
photo Re: Output accuracy (all 10)
Sat 11th Sep 2021, 6:59am, Christopher M.
That is exactly what the Clarification states, though values that are double those of the *sample solution* may require inspection - for example, a project could be implementing everything 'correctly', but have simply missed a ++metric; somewhere....
photo Re: Can't see Global Vars in My Debugger (all 5)
Sat 11th Sep 2021, 6:52am, Christopher M.
ANONYMOUS wrote: Yes, lldb (and many others) do, but it's unsurprising that it considerably slows down the execution - between every instruction (theoretically, say, every billionth of a second, the debugger has to scan through a list of watched variables...
photo Re: On memory, cache, and statistics (all 25)
Sat 11th Sep 2021, 6:48am, Christopher M.  O.P.
As has been shown, there's many versions of 'correct', but each will produce the same computational snd 'print'ed results, and use the cache to minimise accesses to main-memory. As for all projects, you'll implement what you believe to be correct (but...
photo Re: program running time and marking (both)
Sat 11th Sep 2021, 6:34am, Christopher M.
ANONYMOUS wrote: There will concern if your program runs slowly because of a poor approach, but not because you're running it on slow hardware. All projects will be tested/marked on the same hardware, and compiled without any optimization. But 60seconds...
photo Re: Headers (all 6)
Sat 11th Sep 2021, 6:25am, Christopher M.
Error handling with files, in C11, is provided by checking the return values of functions that open and read from the file, not from the approach taken by exceptions - 'just do it and see if anything breaks'. Still can't imagine why you'd want/need an exponential...
photo Re: Locals.coolexe and Globals.coolexe (both)
Sat 11th Sep 2021, 6:21am, Christopher M.
ANONYMOUS wrote: If a function doesn't have an explicit return statement, then an implicit one is added (otherwise the program will just continue 'beyond' the function until it hits a Halt instruction. The function then returns with whatever value is on...
photo Re: Output statistic exactness expectation (all 5)
Fri 10th Sep 2021, 7:55am, Christopher M.
Please read the updated Clarifications page.
photo Re: On memory, cache, and statistics (all 25)
Fri 10th Sep 2021, 7:54am, Christopher M.  O.P.
Please read the updated Clarifications page.
photo Re: Output accuracy (all 10)
Fri 10th Sep 2021, 7:53am, Christopher M.
Please read the updated Clarifications page.
photo Re: which statistics ne need to return (all 4)
Fri 10th Sep 2021, 7:52am, Christopher M.
Please read the updated Clarifications page.
photo Re: installing curl (all 4)
Fri 10th Sep 2021, 7:22am, Christopher M.
...and did you try the suggestion implemented in the coolc.sh shellscript, itself?
photo Re: On memory, cache, and statistics (all 25)
Fri 10th Sep 2021, 6:33am, Christopher M.  O.P.
ANONYMOUS wrote: It's that I appreciate/understand Jean-Pierre's sentiment that he would have valued clearer information earlier. Only *some* past '2002 projects have marked (numeric) solutions within a certain tolerance.
photo Re: Clarification on cache-memory (all 4)
Fri 10th Sep 2021, 5:58am, Christopher M.
ANONYMOUS wrote: Sorry, but I cannot comprehend what you're asking. Strongly suggest that you re-read the project description, and consult one of the recommended textbooks, as I think there's a lot of misunderstanding here.
photo Re: Headers (all 6)
Fri 10th Sep 2021, 5:56am, Christopher M.
Firstly, header files are not libraries - suggest that you review the relationship between the two. The project description clearly states "You may use any functions from the standard C11 library but must not employ any 3rd-party code or libraries to complete...
photo Re: which statistics ne need to return (all 4)
Fri 10th Sep 2021, 5:50am, Christopher M.
ANONYMOUS wrote: Presumably you would have written that in a sarcastic font? I think, out of frustration, he also would have added that the stats marked (not-required) are not required.
photo Re: Clarification on jeq (all 3)
Fri 10th Sep 2021, 5:48am, Christopher M.
ANONYMOUS wrote: Unclear (to me) how you could have arrived at the second possibility. Have you read the explanation on the Clarifications page?
photo Re: Popping Integers( I_ADD, I_SUB, I_MULT, I_DIV) (all 3)
Fri 10th Sep 2021, 5:45am, Christopher M.
ANONYMOUS wrote: I suggest that you review the Workshop discussing using a stack to evaluate arithmetic. Replacing an item already on the stack with 0 does not remove it from the stack, it merely changes its value. Moreover, it's not meaningful to speak...
photo Re: Has the sample answer been changed recently? (both)
Fri 10th Sep 2021, 5:38am, Christopher M.
Hi Thomas, Yes, the webpage and sample solution have changed a number of times (together). The webpage reports its compilation date in its footer. Other than some cosmetic changes, and the ability to display a program's standard-output, the primary reason...
photo Re: On memory, cache, and statistics (all 25)
Thu 9th Sep 2021, 10:34am, Christopher M.  O.P.
Yes, appreciated. Thanks; happy for that bit!
photo Re: On memory, cache, and statistics (all 25)
Thu 9th Sep 2021, 10:14am, Christopher M.  O.P.
ANONYMOUS wrote: The goal is not to match, or outwit the sample solution. The goal is, as you've described, to implement something producing the correct *results* (execution by the program), and not the identical statistical measures given that there are...
photo Re: On memory, cache, and statistics (all 25)
Thu 9th Sep 2021, 7:40am, Christopher M.  O.P.
Yes, that was a blunder introduced when adding comments, and accidentally commenting out a return statement :-( Updated solution doing far better now.
photo Re: On memory, cache, and statistics (all 25)
Thu 9th Sep 2021, 7:37am, Christopher M.  O.P.
I've also found that you can save a huge number of writes if you don't write-back a value that is the same as the new value - again, depending on the program being tested. We'll be (have to) marking submissions using programs where it's a lot easier to...
photo Re: Project 1 - Reading contents of coolexe into main memory (all 7)
Thu 9th Sep 2021, 7:24am, Christopher M.
Further to this, if the data you wish to read in is 16-bits wide (our AWORD and IWORD user-defined datatypes), then the requests to read in the data should be made for that size, or multiples of that size.
photo Re: index and tag in cache (both)
Thu 9th Sep 2021, 5:27am, Christopher M.
Please see this discussion from a couple of weeks ago: https://secure.csse.uwa.edu.au/run/help2002?p=np&a=262&all=y4
photo Re: How to return to the callee's function after popr? (both)
Thu 9th Sep 2021, 5:25am, Christopher M.
ANONYMOUS wrote: You don't really need to pop the local variables and parameters if you just (already) know where you want the SP to end up when control is back in the caller. You'll also notice that if your function doesn't have a return statement, that...
photo Re: Printing from child processes (both)
Thu 9th Sep 2021, 5:18am, Christopher M.
ANONYMOUS wrote: I trust that this question is asked with reference to some other programming/exercise, as fork+exec is certainly not required for our 1st project? The 'trick' is to remember that calling fork() results in the parent's memory being duplicated,...
photo Re: Pushr confusions (all 4)
Thu 9th Sep 2021, 5:10am, Christopher M.
insinuates ? suggests ?
photo Re: Call and the boot segment (all 3)
Wed 8th Sep 2021, 6:19am, Christopher M.
ANONYMOUS wrote: Unsure what you mean by 'work around'. The code in the boot-segment calls your main() function, which returns, and then the Halt instruction causes the program to terminate. The Halt is not to be avoided. It's unclear from your question...
photo Re: IWORD/AWORD conflict issues? (all 3)
Tue 7th Sep 2021, 7:41pm, Christopher M.
Hello Cameron, There's been a number of threads on this topic already. Please see: https://secure.csse.uwa.edu.au/run/help2002?p=np&a=253 https://secure.csse.uwa.edu.au/run/help2002?p=np&a=268 https://secure.csse.uwa.edu.au/run/help2002?p=np&a=353
photo Re: On memory, cache, and statistics (all 25)
Tue 7th Sep 2021, 6:56am, Christopher M.  O.P.
ANONYMOUS wrote: Yes, at most 32; actual number will depend on the size of the program and its mix of memory- accesses. How do you know if it's the first access? If you introduce an extra tag, it will become set, but then never be changed again. I think you're...
photo Re: On memory, cache, and statistics (all 25)
Tue 7th Sep 2021, 6:44am, Christopher M.  O.P.
ANONYMOUS wrote: Wishing that you were NOT posting such detailed descriptions of your project. - it's akin to sharing source code, - it's the very reason we encourage students to work in pairs, and - it dissuades other students from reading a chapter from...
photo Re: Project 1 - Reading contents of coolexe into main memory (all 7)
Tue 7th Sep 2021, 6:39am, Christopher M.
OP - please read: https://secure.csse.uwa.edu.au/run/help2002?p=np&a=270&all=y2 Just to clarify, Travis is talking about the IWORD user-defined type in our project, not the base integer datatype in C11 programs.
photo Re: Cache and number-of-main-memory-writes (all 11)
Mon 6th Sep 2021, 8:12am, Christopher M.
ANONYMOUS wrote: I may have missed the sarcasm, but there's no need to flush cache values back to main-memory if the whole program is just about to terminate! But, whether or not these apparent optimisations work depends on where values on the stack 'land'...
photo [just for fun] on Instructions and OpCodes
Mon 6th Sep 2021, 8:04am, Christopher M.
Some students have asked how we came up with the set of 17 instructions for the 1st project, whether 17 was some magic number, and whether it could be done with fewer. Well, there's nothing magic about 17, and it's easy to imagine/desire a few more helpful...
photo Re: Should returning the result add to the read count? (both)
Mon 6th Sep 2021, 7:21am, Christopher M.
ANONYMOUS wrote: If you're returning (or just using) the value on the TOS, then that value must have recently been pushed to the TOS. If you have a cache implemented, that value will be in the cache as a consequence of the push, and so shouldn't require...
photo Re: Return Clarification (both)
Mon 6th Sep 2021, 7:16am, Christopher M.
Write some different cool programs, with main() calling a function(), and add different numbers (0, 1, 2) of parameters and local variables to the function. Compile each program, and watch how, to where, that value for FP+value changes for each program....
photo Re: On memory, cache, and statistics (all 25)
Mon 6th Sep 2021, 7:11am, Christopher M.  O.P.
I think you mean *top* of stack. I believe it's safe, because stack locations should always be written to before be being read back, so they can't have anything critical in them. So, yes (though I wish you hadn't given so much of the game away).
photo Re: On memory, cache, and statistics (all 25)
Mon 6th Sep 2021, 7:07am, Christopher M.  O.P.
Hello Travis, Sounds impressive; would you mind *emailing* me, not posting, your solution? I'm keen to see how you've done this (hopefully without adding complexity). Wondering if some of the difference is due to this: https://secure.csse.uwa.edu.au/run/help2002?p=np&a=388&all=y2...
photo Re: On memory, cache, and statistics (all 25)
Mon 6th Sep 2021, 6:54am, Christopher M.  O.P.
ANONYMOUS wrote: Thanks (though a bit of context would have helped).
photo Re: Instructions (all 3)
Mon 6th Sep 2021, 6:48am, Christopher M.
ANONYMOUS wrote: The words being referred to are not English words, or strings describing the 17 instructions. They are the 16-bit words of the stack-machine's memory, each of which holds an instruction, an integer, or an address. Some instructions are 'self-contained',...
photo Re: clarification on SUB and DIV (all 3)
Mon 6th Sep 2021, 6:41am, Christopher M.
ANONYMOUS wrote: Travis's response is very helpful, but a further polite and serious suggestion - the computer in front of you has executed 100,000+ lines of code just to post your question. It's a significant experimental tool, that's almost impossible...
photo Re: Can't see Global Vars in My Debugger (all 5)
Mon 6th Sep 2021, 6:30am, Christopher M.
Sorry, no idea; have never used CLion, but it sounds like a serious deficiency with that debugger.

UWA week 35 - 2nd semester, week 6

photo Re: lower memory read values than the sample solution output (all 18)
Sun 5th Sep 2021, 9:25am, Christopher M.
Look, over here: https://secure.csse.uwa.edu.au/run/help2002?p=np&a=432
photo Re: Cache and number-of-main-memory-writes (all 11)
Sun 5th Sep 2021, 9:25am, Christopher M.
Look, over here: https://secure.csse.uwa.edu.au/run/help2002?p=np&a=432
photo Re: Output statistic exactness expectation (all 5)
Sun 5th Sep 2021, 9:25am, Christopher M.
Look, over here: https://secure.csse.uwa.edu.au/run/help2002?p=np&a=432
photo On memory, cache, and statistics (all 25)
Sun 5th Sep 2021, 9:24am, Christopher M.
OK, have I've finally read through all the comments about memory reads and writes and collecting statistics. Has been really impressive following the conversations, and trying to reverse-engineer your collective reverse-engineering of the sample solution!...
photo Re: saving and running coolexe files (all 3)
Sun 5th Sep 2021, 7:44am, Christopher M.
ANONYMOUS wrote: Hello, I can't quite understand whether you're having problems with the website (as no-one else has reported similar problems), or not. I suspect it's more a mis-understanding about the 'workflow', as the first reply has explained. The .coolexe...
photo Re: Output statistic exactness expectation (all 5)
Sun 5th Sep 2021, 7:33am, Christopher M.
ANONYMOUS wrote: Be very careful when using -O3. (Believe it or not) both gcc and clang offer no guarantees that -O3 optimization produces faster or even correct code. You may be lucky if both your regression tests succeed and your run-times are lower,...
photo Re: prints instruction (all 12)
Sun 5th Sep 2021, 7:23am, Christopher M.
Got it yet?
photo Re: prints instruction (all 12)
Sat 4th Sep 2021, 8:49am, Christopher M.
ANONYMOUS wrote: Hi OP, Peter's reply is a very good hint (though a tiny bit more complicated than needs be). Forget the concern of 'a 5 digit number'. We have a 16-bit word, which we know can be considered a 2 x 8-bit integers (C's characters are just small...
photo Re: lower memory read values than the sample solution output (all 18)
Sat 4th Sep 2021, 8:24am, Christopher M.
Hi Everyone, not ignoring you, and plan to reply to this, and the other main thread, later today. "It's complicated".
photo Re: Cache and number-of-main-memory-writes (all 11)
Sat 4th Sep 2021, 8:24am, Christopher M.
Hi Everyone, not ignoring you, and plan to reply to this, and the other main thread, later today. "It's complicated".
photo Re: prints instruction (all 12)
Fri 3rd Sep 2021, 10:51am, Christopher M.
ANONYMOUS wrote: (a slightly different wording of the problem) If I have an integer value, say 28, how do I 'extract' from it the two values of '2' and '8' ?
photo Re: prints instruction (all 12)
Fri 3rd Sep 2021, 8:30am, Christopher M.
I appreciate that computing history has far more interest to me than most of you (end of life is like that!), but you may hit this symptom when implementing prints : https://green-possum-today.blogspot.com/2018/09/the-true-origin-of-nuxi-problem.html...
photo Re: WSL2 (all 6)
Fri 3rd Sep 2021, 4:30am, Christopher M.
The # is the default root prompt - https://stackoverflow.com/questions/66969506/whats-the-default-root-bash-prompt so if you're seeing that, you should just be able to type bash/shell commands such as date to check if it's working. You type that command...
photo Re: prints instruction (all 12)
Fri 3rd Sep 2021, 4:25am, Christopher M.
ANONYMOUS wrote: The above is crucial to understanding what's happening. Our machine's words are 16-bits, 2 bytes, wide, so each can hold 2 characters. Also remember that C strings are NULL-byte terminated so, while strlen("abc") is 3, it requires 4 bytes...
photo Reminder - Workshop #6, Friday 2nd
Thu 2nd Sep 2021, 2:05pm, Christopher M.
Just a reminder, while your focus is mostly on your 1st project, of tomorrow's workshop. This is the first of several (the remaining) workshops where we look at a topics/questions from past exam papers and, thus, provides a good opportunity to see what...
photo Re: Project 1: What does main memory read/writes mean? (all 3)
Thu 2nd Sep 2021, 12:55pm, Christopher M.
ANONYMOUS wrote: It's not immediately clear, from your wording, how you've implemented the 'flow' on information, in both directions, between CPU, cache, and RAM. Do you mean 'there is no cache', or 'fetching from RAM, but not the cache'? For example, with...
photo Re: Can a write_memory produce a cache hit? (both)
Thu 2nd Sep 2021, 4:42am, Christopher M.
ANONYMOUS wrote: Thanks for the post; different textbooks certainly define what a cache hit is, i.e. when it gets counted. Some will split their definition into two - read-hits, and write-hits. In most programming we see that reads from memory occur 5-10x...
photo Re: cache in project 1 (all 7)
Wed 1st Sep 2021, 6:44pm, Christopher M.
ANONYMOUS wrote: No, 32 words of content, plus whatever additional storage you need for the housekeeping (unspecified as to how).
photo Re: Is there a specific cache replacement policy we need to implement? (all 3)
🤔Wed 1st Sep 2021, 6:38pm, Christopher M.
Discussed here: https://secure.csse.uwa.edu.au/run/help2002?p=np&a=264&all=y2
photo Re: cache in project 1 (all 7)
Wed 1st Sep 2021, 5:44pm, Christopher M.
I think it's better now (though the internal code is less elegant). Thanks.
photo Re: Effect of X Macros on readability (both)
Wed 1st Sep 2021, 5:32pm, Christopher M.
It's a technique that I use very frequently, but I've not known it by the name X Macros before. I often use it when writing parsers, probably following the abuse-the-preprocessor approach of lex and yacc. The specification of Linux system calls is another...
photo Re: cache in project 1 (all 7)
Wed 1st Sep 2021, 5:05pm, Christopher M.
ANONYMOUS wrote: No, my question was based on you sounding like you didn't know/understand how to place 32 items in a 32 item cache. Perhaps just the wording. Thanks; I'll fix the sample's reporting. It's just the challenge of reporting everything, to everyone...
photo Re: cache in project 1 (all 7)
Wed 1st Sep 2021, 4:39pm, Christopher M.
ANONYMOUS wrote: Can you please email me the program that generates these negative number of reads. Yes (I don't understand your question). Why can you not store 32 values in the 32 word cache?
photo Re: terminal error (all 7)
Wed 1st Sep 2021, 4:37am, Christopher M.
ANONYMOUS wrote: As above, it's probably the text file named .bashrc or .bash_profile in your home directory. While the error message is indicating a problem, it's likely just something that your interactive shell is 'missing out on', rather than anything...
photo Re: No Mid-Sem Test right? (all 5)
Wed 1st Sep 2021, 4:35am, Christopher M.
(Politely, but a rather frustratingly) if there was a mid-semester test, where do you think it would be announced, or where and why would it have been 'hidden' such that you would have missed the information? How are you even aware of the 2 projects...
photo Re: Sample solution output without cache (all 4)
Tue 31st Aug 2021, 6:30pm, Christopher M.
There you go; now runs the sample solution twice, once without caching, then once with. Ahhh, programming - beats working!
photo Re: terminal error (all 7)
Tue 31st Aug 2021, 5:33pm, Christopher M.
You edit the file, find the 3 lines with 'Export', and change them to 'export'.
photo Re: Sample solution output without cache (all 4)
Tue 31st Aug 2021, 5:22pm, Christopher M.
ANONYMOUS wrote: Hmmm, a reasonable request, but it'll require a little thinking as to how to combine the two in the same solution. Hmmmm, maybe run each program twice, once with and once without. Will give it some thought.
photo Re: terminal error (all 7)
Tue 31st Aug 2021, 5:05pm, Christopher M.
ANONYMOUS wrote: It looks like you've recently modified your .bashrc or .bash_profile file, to add a new line(s) commencing with 'Export'. However, case is significant to bash, and there is no known command named Export. The correct command is 'export',...
photo Re: Uploading file to cool.c Website (all 6)
Tue 31st Aug 2021, 1:36pm, Christopher M.
ANONYMOUS wrote: Happy to find the solution with you, but that's not it. The website doesn't care where the plain-text source file came from; doesn't have to be from vim. But be careful if you're using a tool like Word or similar to create (any) textfile,...
photo Re: Uploading file to cool.c Website (all 6)
Tue 31st Aug 2021, 12:53pm, Christopher M.
Works for me: int main(void) { print "a"; }
photo Re: Uploading file to cool.c Website (all 6)
Tue 31st Aug 2021, 12:50pm, Christopher M.
ANONYMOUS wrote: The syntax error detection is not great, but you have to try to send it valid cool programs, not C programs. Look at the many provided example programs, or the cool syntax page. You want: print "a";
photo Re: Can we change the type of main_memory? (both)
Tue 31st Aug 2021, 12:47pm, Christopher M.
ANONYMOUS wrote: No it doesn't. They are not converted, and you are only 'seeing' any conversion when you ascribe a meaning to the 16-bit quantities. No, no changes. That would entirely change the nature of the project, and ignore the fact that we're representing...
photo Re: popr functionality clarification (all 8)
Tue 31st Aug 2021, 9:34am, Christopher M.
Yes, it's the former. The popr instruction is used for updating a function's parameters and local variables, both of which exist on the stack while the function is executing (either side, +ve and -ve, of the FP).
photo Project-1 website and sample solution updated
Tue 31st Aug 2021, 7:33am, Christopher M.
Our 1st project's website: https://secure.csse.uwa.edu.au/run/coolc has been updated, and the sample solution (which run's 'behind' that website) has been updated to implement the write-back cache. The sample solution has been written in a style hopefully...
photo Another annual survey of programming language 'popularity' released
Tue 31st Aug 2021, 7:10am, Christopher M.
The respected annual survey of programming language popularity, by IEEE Spectrum, has just been released: https://spectrum.ieee.org/top-programming-languages-2021
photo Re: Minor issue when printing exit status (all 3)
Tue 31st Aug 2021, 4:15am, Christopher M.
ANONYMOUS wrote: Hi, A good observation. When a Linux process calls the exit() system-call, it passes it an integer exit status (typically 32-bits on your laptop). The kernel interprets 16-bits of this integer as a combination of 3 smaller integers: -...
photo Re: main-memory-reads-(fast-jeq) (both)
Tue 31st Aug 2021, 3:57am, Christopher M.
ANONYMOUS wrote: Please read the Clarifications page.
photo Re: WSL2 (all 6)
Mon 30th Aug 2021, 4:52pm, Christopher M.
Is anyone with more Windows experience able to assist here?
photo Re: Question about storage size of cache (all 4)
Mon 30th Aug 2021, 4:51pm, Christopher M.
ANONYMOUS wrote: The cache has 32 words of cached words from the main_memory. Any housekeeping information is in addition to those 32 words. Please read a chapter from a good OS or computer architecture textbook, or online tutorial, about caches (and don't...
photo Re: lower memory read values than the sample solution output (all 18)
Mon 30th Aug 2021, 5:49am, Christopher M.
Interesting that you can calculate something correctly, without understanding what it is :-)
photo Re: lower memory read values than the sample solution output (all 18)
Mon 30th Aug 2021, 5:47am, Christopher M.
ANONYMOUS wrote: Thanks for that - a better solution, and great detective work! The sample solution has been modified to report both possible memory-read statistics, and we'll be looking for either of these values when marking your projects. (makes you wonder...

UWA week 34 - 2nd semester, week 5

photo Re: Is it necessary to cache values when popping from memory? (both)
Sun 29th Aug 2021, 5:32pm, Christopher M.
ANONYMOUS wrote: Yes, and yes. Data flows from RAM (incl. the stack) to CPU, through the cache. The cache has no idea what the data was requested for, or which part (role) of the RAM it came from.
photo Re: pusha (all 8)
Sun 29th Aug 2021, 5:22pm, Christopher M.
ANONYMOUS wrote: Something for you to think about and experiment with. No need to wonder - the computer in front of you is an experimental tool that's almost impossible to break.
photo Re: pusha (all 8)
Sun 29th Aug 2021, 5:14pm, Christopher M.
ANONYMOUS wrote: Don't quite understand your wording, but why can't you use the value in the PC register to indicate which memory location you want?
photo Re: Loading instructions into main memory + role of cache (both)
Sun 29th Aug 2021, 5:13pm, Christopher M.
ANONYMOUS wrote: No. Our statistics only start accumulating once we start executing the program. The cache only 'fills' up with data from both RAM and the CPU, not from our .coolexe file which would be read from disk: https://slideplayer.com/slide/14630644/90/images/2/Memory+Hierarchy+In+previous+lectures%2C+we+took+a+lot+of+time+to+understand+memory+hierarchy.+It+consists+of+several+levels+of+storage+components..jpg...
photo Re: pusha (all 8)
Sun 29th Aug 2021, 5:05pm, Christopher M.
ANONYMOUS wrote: You can't, and don't need to distinguish between them. They are both just 16-bit quantities (by design).
photo Re: pusha (all 8)
Sun 29th Aug 2021, 5:04pm, Christopher M.
ANONYMOUS wrote: You can push *anything* on to the stack; no special treatment for addresses.
photo Re: Regarding the return instruction... (both)
Sun 29th Aug 2021, 5:02pm, Christopher M.
ANONYMOUS wrote: The value to be returned is already on the TOS; the word following the I_RETURN instruction is a frame-pointer offset, indicating where the returned value has to go.
photo Re: lower memory read values than the sample solution output (all 18)
Sun 29th Aug 2021, 4:58pm, Christopher M.
ANONYMOUS wrote: Hi, Impressive stuff (assuming we both have those extra stats counting correctly. I suggest that you just use your text-editor to search for possible places where you're accessing main_memory[] directly, without counting the accesses. Yes;...
photo Re: prints (both)
Sun 29th Aug 2021, 4:47pm, Christopher M.
Oops; actually a problem with the HTML formatting on the webpage, corrected now. Thanks for reporting it.
photo Re: Floating point exception (all 5)
Sun 29th Aug 2021, 6:19am, Christopher M.
ANONYMOUS wrote: Looks like you're mis-interpreting which instructions have a following word, hitting a 5 (=div), and then trying to execute that.
photo Re: Statistics Testing (all 4)
Sun 29th Aug 2021, 6:15am, Christopher M.
ANONYMOUS wrote: Hi. The coolc webpage now runs the sample solution, and reports main-memory statistics (no cache-memory, yet).
photo Re: Compiler Bug causes infinite loop (all 4)
Sun 29th Aug 2021, 6:14am, Christopher M.
I think that this is corrected now; please let me know...
photo Re: Floating point exception (all 5)
Sat 28th Aug 2021, 9:27pm, Christopher M.
Usually division (or modulus) by zero.
photo Re: Compiler Bug causes infinite loop (all 4)
Sat 28th Aug 2021, 8:49pm, Christopher M.
Interesting - thanks :-) Looks like toto() is missing its (implicit) return instruction. Won't be able to correct this until tomorrow morning.
photo Re: ‘main’ defined but not used (all 4)
Sat 28th Aug 2021, 8:26pm, Christopher M.
It looks like you have too many (or too few?) closing curly brackets for function execute_stackmachine.
photo Re: hard to find partners (all 5)
Sat 28th Aug 2021, 7:51pm, Christopher M.
ANONYMOUS wrote: As you will have noticed, I've sent an email, via LMS, to all students in the unit reminding them that they can work in teams, and can use help2002 to express an interest in finding a project partner. I do not believe that there is any...
photo Re: ‘main’ defined but not used (all 4)
Sat 28th Aug 2021, 7:35pm, Christopher M.
Then you have somehow changed, and broken it, or are compiling it incorrectly.
photo Re: int and AWORD types in Project 1 (both)
Sat 28th Aug 2021, 6:58pm, Christopher M.
Hello; I feel that you're getting overly concerned about something that's not important. ANONYMOUS wrote: As stated in the last sentence of: https://secure.csse.uwa.edu.au/run/help2002?hl=hindsight&a=266 Change them if you wish, but note that the change...
photo Re: globals and functions in cool (all 4)
Sat 28th Aug 2021, 6:40pm, Christopher M.
ANONYMOUS wrote: No, that would be far too strict a restriction. As you can see from the language's syntax (I appreciate that it may be a new concept to you): https://teaching.csse.uwa.edu.au/units/CITS2002/projects/coolsyntax.php local (and global) variables,...
photo Re: Statistics Testing (all 4)
Fri 27th Aug 2021, 1:47pm, Christopher M.
Eventually/soon, but not today.
photo Re: .coolexe file (both)
Fri 27th Aug 2021, 1:41pm, Christopher M.
fgets() is a great function for reading lines of text from files. It is not used for reading arbitrary bytes of data, some of which may be zero-bytes (NULL-bytes) which have a special meaning when dealing with strings. Suggest that you review Lecture.8...
photo Re: AWORD vs IWORD for main_memory (all 5)
Fri 27th Aug 2021, 1:36pm, Christopher M.
ANONYMOUS wrote: Yes. This code will show you that an AWORD *can* store a negative value, without conversion. It's all about how the contents of the variable's memory is used in a context: #include <stdio.h> #include <stdint.h> int main(int argc, char *argv[])...
photo Re: Project 1 Types (both)
Fri 27th Aug 2021, 5:28am, Christopher M.
ANONYMOUS wrote: Yes, that's the intent. Both data types have the same (physical) size, and so the contents of either type may be copied/stored in the other. The only difference you may see is based on how you interpret/use those values. However, as you'll...
photo Re: Cache policy question (both)
Fri 27th Aug 2021, 3:24am, Christopher M.
Hello, There is no need for a specific cache replacement policy. Each location from main memory has only one possible location in cache memory where it can be mirrored (always the same location), and each location in cache memory remembers which location...
photo Re: Question about storage size of cache (all 4)
Thu 26th Aug 2021, 4:21pm, Christopher M.
No, not included. They are an overhead, necessary to design/implement the cache itself - 'housekeeping'.
photo Re: Minor oversight in starting code that could lead to undefined behaviour (all 4)
Thu 26th Aug 2021, 3:25pm, Christopher M.
But we push things on to the stack by *decrementing* the SP - stack grows downwards. You modify SP before modifying the stack.
photo Re: Minor oversight in starting code that could lead to undefined behaviour (all 4)
Thu 26th Aug 2021, 2:30pm, Christopher M.
But wouldn't the very first thing you'd ever do is to push something onto the stack, not to use the TOS immediately? Have a look at the first code that ever runs - in the boot-segment.
photo Re: Project 1 Clarifications (both)
Thu 26th Aug 2021, 12:30pm, Christopher M.
ANONYMOUS wrote: Good for asking, but there appears to be some fundamental confusion here. Wondering if you've been able to get along to a lab session, and/or last Friday's workshop? The memory is used to store instructions, your global data/variables,...
photo An interesting new Linux system-call
Thu 26th Aug 2021, 9:30am, Christopher M.
May be of interest for those studying Cybersecurity: "After many months of development, the memfd_secret() system call was finally merged for the upcoming 5.14 release of Linux. There have been many changes during this feature's development, but its core...
photo Notable birthdays this week
Thu 26th Aug 2021, 4:51am, Christopher M.
While we've been focusing on the 1st project, a couple of significant birthdays have snuck by: Linux turns 30 years old: https://www.theregister.com/2021/08/25/linux_kernel_30_years_old/ The IBM PC turns 40: https://www.theregister.com/2021/08/12/ibm_pc_40_anniversary/...
photo Re: Project 1- (all 10)
Wed 25th Aug 2021, 5:40pm, Christopher M.
That's OK. They are good questions, and hopefully slower-starters will actually read and understand them, rather than asking them again! YOU don't; that's the coolc compiler's job, to emit correct code based on the source program. The role of your runcool...
photo Re: Questions for Project 1 (all 7)
Wed 25th Aug 2021, 5:37pm, Christopher M.
ANONYMOUS wrote: No. The returned value needs to be on the TOS of the caller's stack frame (it will be a new entry on that frame). You cannot leave it in the callee's stack frame, as you must remove/pop the callee's parameters before returning, and they...
photo Re: about statistics in project1 (all 5)
Wed 25th Aug 2021, 5:34pm, Christopher M.
Please see the new section "Main memory and cache memory" on the COMPLETED project description.
photo Re: Luhn code, str of number > 10 as arg, does not transfer into str (all 3)
Wed 25th Aug 2021, 5:33pm, Christopher M.
Make sense? Any progress?
photo Re: Can't launch Docker (all 5)
Wed 25th Aug 2021, 5:33pm, Christopher M.
Any success?
photo Re: bool value (all 3)
Wed 25th Aug 2021, 5:33pm, Christopher M.
Make sense?
photo Engineering (and CSSE!) students' employability workshop
Wed 25th Aug 2021, 5:22pm, Christopher M.
UWA engineering graduate, Dassault software consultant and star of UWA’s ‘The Interview’ TVC Nirajit Syamal will be delivering a workshop on how UWA engineering (and CSSE) students can enhance and promote their employability – specifically through...
photo Re: Project 1- (all 10)
Wed 25th Aug 2021, 1:15pm, Christopher M.
ANONYMOUS wrote: Hi, I think this will answer your question: https://secure.csse.uwa.edu.au/run/help2002?p=np&a=235 Strings now understood/working OK for you?
photo Re: Questions for Project 1 (all 7)
Wed 25th Aug 2021, 6:19am, Christopher M.
I've updated the wording and the diagram of the section "Calling and returning from functions" on the project's description. Please let me know if that's clearer. The returned value needs to be copied to the first location of the current stack frame, so...
photo Re: Project 1- (all 10)
Wed 25th Aug 2021, 4:16am, Christopher M.
ANONYMOUS wrote: This problem corrected now; thanks for reporting it.
photo Viewing the complexity of OS kernels
Wed 25th Aug 2021, 4:13am, Christopher M.
In Lecture-10 there's 2 images (via p1) that show the complexity of the Linux and Windows OS kernels. I've re-found a better representation of the Linux kernel, the 2nd link of which allows you to navigate through its code (an older than you're probably...
photo Re: Can't launch Docker (all 5)
Wed 25th Aug 2021, 3:38am, Christopher M.
ANONYMOUS wrote: I've not seen this problem myself, but there's a number others that have had the problem: https://github.com/docker/for-mac/issues/5037 with many recent comments (last couple of weeks) identifying solutions that have worked for them. Maybe:...
photo Re: Luhn code, str of number > 10 as arg, does not transfer into str (all 3)
Wed 25th Aug 2021, 3:31am, Christopher M.
I'm wondering if you're trying to store the value as an integer, rather than as a string? A 32-bit signed integer is able to store integers in the range -2147483648 to 2147483647, and larger values will overflow that range. See: #include <stdio.h> int main(int...
photo Re: bool value (all 3)
Tue 24th Aug 2021, 6:16pm, Christopher M.
ANONYMOUS wrote: Good question. The correct way to think about this is to NOT focus on the implementation details, but to focus on the meaning of what you're trying to do. Firstly, C considers a non-zero value as a true value and, thus, a zero value is considered...
photo Re: Questions for Project 1 (all 7)
Tue 24th Aug 2021, 8:20am, Christopher M.
Thanks (for the first part) - would be good to hear what you're enjoying. the RETURN instruction does require 2 words - the 1st for the op-code, and the 2nd to indicate where the function's returned value should be copied. A new section now added to the...
photo Re: about statistics in project1 (all 5)
Mon 23rd Aug 2021, 7:30pm, Christopher M.
ANONYMOUS wrote: No, I don't believe so. Cache memory is part of the standard memory hierarchy of contemporary computer systems, introduced in Week-3. If you've been keeping up with the lecture material, and also undertaking additional deeper reading...
photo Re: about statistics in project1 (all 5)
Mon 23rd Aug 2021, 6:36pm, Christopher M.
Explanations to these points coming in the new section on Cache Memory. Not too long now....
photo Re: Project 1 negative numbers in main_memory (both)
Mon 23rd Aug 2021, 6:33pm, Christopher M.
ANONYMOUS wrote: A good and relevant question, at this stage, BUT not the sort of question to be asked and simply answered through this forum. HOWEVER, it's exactly the sort of question to discuss with your project partner, explaining what you've already...
photo Re: hard to find partners (all 5)
Mon 23rd Aug 2021, 2:09pm, Christopher M.
Hello, I suggest you post a request here: https://secure.csse.uwa.edu.au/run/help2002?p=np&a=202&all=y2 I don't wish to force students to work together if they don't want to.
photo Re: Project 1 (all 10)
Mon 23rd Aug 2021, 9:36am, Christopher M.
ANONYMOUS wrote: From the project's website: https://secure.csse.uwa.edu.au/run/coolc you'll see some small sample/test programs that you can view and compile. Nothing there to really understand; the link was just placed there for historic interest (now,...
photo Re: Project 1 Standard of C (both)
Mon 23rd Aug 2021, 9:07am, Christopher M.
ANONYMOUS wrote: Just a typo - corrected to C11; thanks.

UWA week 33 - 2nd semester, week 4

photo Re: function calls using variable names cause compile errors depending on syntax - explain why please? (all 5)
Sun 22nd Aug 2021, 6:30pm, Christopher M.
Because you've defined datacheck[] as an array, and not as a scalar variable. Function alpha_val() expects and array as its parameter, so all is good. In contrast, callval is a scalar variable, which is not what alpha_val() expects. You can't. You must...
photo Re: function calls using variable names cause compile errors depending on syntax - explain why please? (all 5)
Sun 22nd Aug 2021, 3:17pm, Christopher M.
Hello Malcolm, Happy to try to answer this, but I can't read the dark purple colour on your black background - the line in the yellow box. BUT, in the green box you're CORRECTLY passing (the address of) a character array to alpha_val(), but in the red...
photo Re: Workshop 4 solution developed (all 3)
Sun 22nd Aug 2021, 5:18am, Christopher M.
ANONYMOUS wrote: Indeed; there now, via the Schedule page (sorry for the delay, been focused on getting the 1st project complete).
photo 1st Project description COMPLETE
Fri 20th Aug 2021, 5:41pm, Christopher M.
The 1st project description is now COMPLETE and available, from: https://teaching.csse.uwa.edu.au/units/CITS2002/projects/project1.php New section added: "Main memory and cache memory" Section reworded: "Calling and returning from functions" Nearly all...
photo Re: Project / exam author (both)
Fri 20th Aug 2021, 4:43am, Christopher M.
ANONYMOUS wrote: It's a joint effort; Amitava is the unit-coordinator, and so has the final decision. So now we need to know why you're asking? :-)
photo Re: about project1 (all 3)
Thu 19th Aug 2021, 7:41am, Christopher M.
ANONYMOUS wrote: Hi, No; the 1st project only covers/assesses materials from Weeks 1-4, from all those lectures, labs, and workshops. The "answer" to the project, is not simply hidden in those teaching materials, and you'll need to investigate some of...
photo Re: Lab 3 Question 6 (both)
Thu 19th Aug 2021, 7:38am, Christopher M.
ANONYMOUS wrote: You are correct - it would be a problem if the string (array) holding the final result was too short to hold the result. However, in this example, the prototype: void replace( char oldword[], char newword[], char whole_sentence[] );...
photo Re: Alias for default c program (all 5)
Wed 18th Aug 2021, 1:10pm, Christopher M.
Shell aliases are usually only one line long; if we want a multi-line 'alias', we should use a shell function. This is what I use to quickly create a new C file, and then to edit it with vi. Just like a shell alias, you'll need to place it in one of your...
photo Re: some question about stackmachine() function (all 5)
Wed 18th Aug 2021, 4:57am, Christopher M.
ANONYMOUS wrote: You could add a global variables somewhere, or modify the code in any way you wish to build your solution. But remember that unnecessary global variables are a bad practice. Try to find the spot in your code where such a new variable is...
photo Re: some question about stackmachine() function (all 5)
Wed 18th Aug 2021, 4:54am, Christopher M.
ANONYMOUS wrote: There's a good reason for that. The single statement: return stack[SP--]; is, of course, similar to: SP--; return stack[SP+1]; but the second case is bad practice, because you're accessing a stack item beyond/after the TOS, Once you've...
photo Re: Implicit Declaration (both)
Wed 18th Aug 2021, 4:49am, Christopher M.
ANONYMOUS wrote: Yes, you're correct. C11 requires that the compiler 'knows about' each identifier (such as a variable or function name) before it can be used. So, you have two options: - define f1 before you use it in f2, or - declare (announce) that f1...
photo Re: Creating alias in docker container? (all 3)
Tue 17th Aug 2021, 2:02pm, Christopher M.
No need to delete your post - if contains the answer to your problem, and may help others.
photo Re: M_PI Undefined (both)
Tue 17th Aug 2021, 2:01pm, Christopher M.
Include <math.h> *after* defining __USE_XOPEN (as in the Workshop, and the sample solution).
photo Preliminary information about Project-1
Tue 17th Aug 2021, 11:14am, Christopher M.
Lots of students emailing with common questions about Project-1, so please read: https://teaching.csse.uwa.edu.au/units/CITS2002/projects/project1.php which should answer all of your questions before Friday. Good luck,
photo Re: using ubuntu and vim/setup/ongoing settings/ files deleting (all 3)
Mon 16th Aug 2021, 5:00pm, Christopher M.
ANONYMOUS wrote: Making some progress now?
photo Re: VS code include path error (both)
Mon 16th Aug 2021, 4:59pm, Christopher M.
I have not seen that error myself, but there appear to be A LOT of suitable responses found from a simple Google search.

UWA week 32 - 2nd semester, week 3

photo Re: Using files on Windows (all 6)
Sun 15th Aug 2021, 6:32pm, Christopher M.
Thanks Jakub.
photo Re: using ubuntu and vim/setup/ongoing settings/ files deleting (all 3)
Sun 15th Aug 2021, 6:31pm, Christopher M.
ANONYMOUS wrote: Your background knowledge and experience is not different to that of many students in the unit, but it seems that you're not taking all opportunities to help yourself out. Firstly, and just to get it out of the way - this is *not* a C coding...
photo Using foreground/background job control in bash
Fri 13th Aug 2021, 12:59pm, Christopher M.
(as very quickly explained in today's workshop) The traditional (40+ year old) way to run the vim editor is inside the same window that receives your shell commands. I choose to edit files and compile them in the same window during workshops (and in most...
photo Re: Workshop 3 related question (all 5)
Fri 13th Aug 2021, 12:57pm, Christopher M.
ANONYMOUS wrote: You mean like this: https://secure.csse.uwa.edu.au/run/help2002?p=np&a=55 ?
photo Re: Workshop 3 related question (all 5)
Fri 13th Aug 2021, 12:50pm, Christopher M.
ANONYMOUS wrote: I was just logged into a staff-only Linux machine, across the wireless network, and had set my shell's prompt (with the intention of it being less confusing. Failed that) You may set your shell prompt to anything you choose with commands...
photo Re: LAB 2 Q5 converting single char to int (all 3)
Fri 13th Aug 2021, 12:45pm, Christopher M.
ANONYMOUS wrote: Characters *are* integers, they are just small (1-byte) integers. But that's not the question you're wishing ask. You're probably noticing that the character expressed as '0' does not have the (integer) value of zero. Compiling and running...
photo Re: Lab 2 (both)
Wed 11th Aug 2021, 5:14pm, Christopher M.
ANONYMOUS wrote: Get rid of the strings as quickly as possible - convert them to integers, then use basic arithmetic (division and modulus using/by 10) to determine the digits of the numbers.
photo Re: error: inactive developer path (all 7)
Wed 11th Aug 2021, 3:26pm, Christopher M.
And, wow, look at how many times the question and the accepted answer have been upvoted!
photo Re: about static variable (all 9)
Wed 11th Aug 2021, 3:20pm, Christopher M.
ANONYMOUS wrote: OK, sounds like you're getting it now. When a program runs, it starts with a 'fresh' copy of its variables (held in memory). When a process terminates, its final values of its variables are entirely forgotten (and the memory it was using...
photo Re: error: inactive developer path (all 7)
Wed 11th Aug 2021, 10:51am, Christopher M.
ANONYMOUS wrote: Sorry, but I can't imagine what the problem is, based on what you're described. My first thought would be that Xcode (and/or the supplementary tools) have not been installed correctly, but I can't tell that for sure. If it's a laptop,...
photo Re: about static variable (all 9)
Wed 11th Aug 2021, 10:49am, Christopher M.
ANONYMOUS wrote: It seems that you're misunderstanding the question, rather than having any programming problems with variables that cannot be modified. If you invoke your program with, say, the arguments: ./rotate9 horse lion 4 elephant 17 22...
photo Re: about static variable (all 9)
Wed 11th Aug 2021, 9:46am, Christopher M.
ANONYMOUS wrote: I was not suggesting that you use 'const' at all. I was indicating that (nearly) all variables, static, global, ..... can be modified. So I do not think that that is your problem. What gives you the suspicion that your variable named 'Rot'...
photo Running Parallels Desktop on your Apple hardware
Wed 11th Aug 2021, 9:00am, Christopher M.
[this is not an advertisement or recommendation for Parallels] Some students have indicated that they are employed part- or full-time, and that they are able to use their employer's provided hardware for their studies. However, their employer has been...
photo Re: Raspberry pi 4 (all 4)
Wed 11th Aug 2021, 7:06am, Christopher M.
ANONYMOUS wrote: Yes, 4GB is a lot, though each individual process may be limited to much less, so that multiple processes can execute 'simultaneously' - the RPi has no fast disk to swap to! I don't think our projects will have huge data requirements.
photo Re: about static variable (all 9)
Wed 11th Aug 2021, 5:18am, Christopher M.
ANONYMOUS wrote: All variables in C11 may be modified** So it does not matter whether a variable is defined as a global, or not, or whether it is declared as a static, or not - your program will always be able to modify it. So your problem is more likely...
photo Re: difference between using a pointer (all 3)
Tue 10th Aug 2021, 7:09pm, Christopher M.
ANONYMOUS wrote: You do not need a pointer as the parameter to isdigit() - the only valid parameter is a character. However, the whole discussion about pointers and their relationship to character strings is coming up in a later lecture: In effect, if you...
photo Re: error: inactive developer path (all 7)
Tue 10th Aug 2021, 5:51pm, Christopher M.
ANONYMOUS wrote: Not seen the error before - but it's (only) from macOS. Have you downloaded the Xcode package, from the App Store? Did you run xcrun yourself (by typing it in), or did 'cc' throw up that error? On my (working) Big Sur installation of Xcode,...
photo Re: Raspberry pi 4 (all 4)
Tue 10th Aug 2021, 3:48pm, Christopher M.
ANONYMOUS wrote: Not really a silly question. I think the answer is 'yes', at least for the labs and the 1st project, but haven't thought enough about the 2nd project, yet. The likely problem will be the RAM available for your application. The strong advice,...
photo Re: Segmentation fault (core dumped) (all 7)
Tue 10th Aug 2021, 2:52pm, Christopher M.
That line looks quite harmless - assuming that you're invoking your program with sufficient command-line arguments. You'll be needing: ./program huge elephant to be able to get the length of the string elephant. Providing sufficient arguments?
photo Re: Segmentation fault (core dumped) (all 7)
Tue 10th Aug 2021, 2:50pm, Christopher M.
This 2nd part of your reply has me very confused ??
photo Re: #include "first_day_of_month.c" // file not found.... (all 3)
Tue 10th Aug 2021, 11:17am, Christopher M.
ANONYMOUS wrote: The C compiler is stating that the file first_day_of_month.c is not found in the same directory as your main C file. You've downloaded it, and copied there? Unsure what this means, but if you've copied the contents of first_day_of_month.c....
photo Are you scared yet, human? (both)
Tue 10th Aug 2021, 6:01am, Christopher M.
A great episode of ABC's Four Corners, last night, if you're interested in AI, large- systems, privacy, the singularity.... Are you scared yet, human? How artificial intelligence is changing our world https://www.abc.net.au/4corners/are-you-scared-yet,-human-how-artificial/13485202...
photo Re: How to actually open rotate.c (all 5)
Tue 10th Aug 2021, 5:14am, Christopher M.
Thanks for your great reply Lewis. Hopefully we can encourage more students to answer each others' questions, here, by offering their suggestions and success-stories.
photo Re: Lab question (lecture coding) (both)
Tue 10th Aug 2021, 4:44am, Christopher M.
Hello, There may be a few things displayed on the screen that just happen 'automatically' as a consequence of the normal workflow. Assuming you've using vim to edit your C source file: prompt-123> vim program.c ... the screen clears and vim displays...
photo Re: lab1 question9 (both)
Tue 10th Aug 2021, 4:30am, Christopher M.
ANONYMOUS wrote: Hi, My suggestion is the same as I wrote here: https://secure.csse.uwa.edu.au/run/help2002?p=np&a=92&all=y2 (don't forget that you can search for things on this forum - searching for 'segmentation' would have quickly found that other article)...
photo Re: Linux Password Problem (both)
Tue 10th Aug 2021, 4:21am, Christopher M.
ANONYMOUS wrote: I may be confused, but it appears that you're running Powershell on a Windows, but are attempting to execute Linux commands (via bash) that should only be executed while running docker. Someone please correct me.
photo Re: Segmentation fault (core dumped) (all 7)
Mon 9th Aug 2021, 1:04pm, Christopher M.
It's not possible to say, definitively, but nearly all segmentation violations are the result of attempting to access memory other than what you program 'owns', or in a manner inconsistent with the way it's been declared. As you're working on the credit...
photo Re: char data type (both)
Mon 9th Aug 2021, 1:00pm, Christopher M.
ANONYMOUS wrote: Hi, As in most programming languages, the datatypes of a function's parameters, and its returned value are very important. n the case of the atoi() function, its single parameter must be a sequence of characters (a string in C), because...

UWA week 31 - 2nd semester, week 2

photo Re: Lab-sheet 2 release (all 5)
Sun 8th Aug 2021, 9:15am, Christopher M.
ANONYMOUS wrote: The 2nd labsheet is now available from our Schedule page. On 'why waiting?' - your question presumes that everything is just 'ready to go', and just needs releasing, in contrast to some things needing to be written or modified first. The...
photo Re: Lab-sheet 2 release (all 5)
Sat 7th Aug 2021, 11:55am, Christopher M.
ANONYMOUS wrote: Some time over the weekend, and before the first last session next week. (politely, we don't forget these things).
photo Re: Lab 1, Questions 9 and 10 (both)
Sat 7th Aug 2021, 6:38am, Christopher M.
ANONYMOUS wrote: Hello, Was not planning on releasing sample solutions for the harder child questions, and have not in previous years. But they are not assessed, so you should be comfortable to discuss them here. A hint for Q9 is to use C's standard isdigit()...
photo Re: lab 1 (all 12)
Sat 7th Aug 2021, 6:35am, Christopher M.
That missing 'fileSharing' option in the Dashboard may only be required/exist on macOS, perhaps needed to politely interface with macOS's System Preferences > Sharing > File Sharing dialogue. There may be a functionally equivalent mechanism on Windows,...
photo Re: Problem on Linux setup (both)
Sat 7th Aug 2021, 6:20am, Christopher M.
You have two typos in your commands: cd/mnt/c/Users..... needs a space to separate the command-name 'cd' from its arguments: cd /mnt/c/Users..... and ubuntu:lastest is spelt ubuntu:latest
photo Re: Win 10 where to save file for ubuntu to find it? (both)
Sat 7th Aug 2021, 6:15am, Christopher M.
The file "linux-cc-basics.php" is a webpage so, unless you've downloaded it to somewhere on your local Windows file-system (such as the Desktop), you will not have it on your local system and, thus, cannot display it with 'cat'. Before running a docker...
photo Re: lab 1 (all 12)
Fri 6th Aug 2021, 2:48pm, Christopher M.
ANONYMOUS wrote: As it appears that you're in Perth, you've welcome to attend any of the weekly CITS2002 lab sessions (not just your allocated one), and ask questions of the lab facilitator, as well.
photo Re: lab 1 (all 12)
Fri 6th Aug 2021, 2:46pm, Christopher M.
ANONYMOUS wrote: You haven't indicated what system/environment you've using, but this step from the webpage - https://teaching.csse.uwa.edu.au/units/CITS2002/labsheets/install-linux.php [email protected] apt-get install -y vim build-essential will install both...
photo Re: Lab Solutions. (both)
Fri 6th Aug 2021, 2:43pm, Christopher M.
ANONYMOUS wrote: As stated in today's workshop, and even posted here: https://secure.csse.uwa.edu.au/run/help2002?hl=solution&a=41 and https://secure.csse.uwa.edu.au/run/help2002?hl=solution&a=68 the sample solution for WS-2 is already linked on...
photo Re: stdio.h not being found (both)
Fri 6th Aug 2021, 2:40pm, Christopher M.
ANONYMOUS wrote: Easy fix - check your spelling of stdio.h :-)
photo Workshop-2 sample solution available
Fri 6th Aug 2021, 11:59am, Christopher M.
... from our Schedule page: https://teaching.csse.uwa.edu.au/units/CITS2002/schedule.php Sample solutions for workshops and labsheets will be available at the end of each week, all via the Schedule page, and (in future) won't be announced. Happy to answer...
photo Re: Recommendation on Linux Installation (all 5)
Fri 6th Aug 2021, 11:30am, Christopher M.
ANONYMOUS wrote: You will need to download a copy of Docker Desktop that suits your system - Windows10, macOS on an Intel processor, or macOS on Apple's M1 processor. Then follow the instructions on the page: https://teaching.csse.uwa.edu.au/units/CITS2002/labsheets/install-linux.php...
photo Re: lab 1 (all 12)
Thu 5th Aug 2021, 2:53pm, Christopher M.
ANONYMOUS wrote: Hi, I'm a bit confused as to where "you're up to" in the steps of: https://teaching.csse.uwa.edu.au/units/CITS2002/labsheets/install-linux.php If you have a Ubuntu image downloaded and populated with necessary packages - providing the...
photo Re: Stuck inside a prompt (both)
Thu 5th Aug 2021, 5:55am, Christopher M.
Hi, (been stuck in this prompt all night, or resolved?) I'm unsure what you mean by 'changed my language' or how just pressing Shift could change that but, in most cases, if you include the character " or ' on the command-line, the line will continue until...
photo Re: lab 1 (all 12)
Thu 5th Aug 2021, 5:45am, Christopher M.
ANONYMOUS wrote: Hi, This a really a more general issue about how to access your Windows or macOS files while working inside docker+Linux. Until familiarity grows, you'll probably find the following way easiest, as it: - gives you the ability to read...
photo Re: Marked Labs? (all 3)
Wed 4th Aug 2021, 10:44am, Christopher M.
ANONYMOUS wrote: If anything like this had been said/asked before, it would also be clearly stated on the unit's webpage. No, labs are not assessed, just the 2 projects and the final exam. I don't know what was done in DSA; Amitava or others may have a...
photo Re: online students (all 3)
Wed 4th Aug 2021, 8:58am, Christopher M.
Please also see: https://secure.csse.uwa.edu.au/run/help2002?p=np&a=49
photo Re: Friday Workshop (all 4)
Wed 4th Aug 2021, 8:42am, Christopher M.
ANONYMOUS wrote: Hello, For the particular benefit of students stuck outside of Perth, there are two 2 hour online laboratory sessions each Friday (12-2, 2-4) at which students will be able to gain assistance from laboratory demonstrators. You may attend...
photo Re: The use of Linux (and vim) and it's role in the unit (all 3)
Wed 4th Aug 2021, 7:09am, Christopher M.
ANONYMOUS wrote: There's a few solid reasons for focusing on a single operating system platform in this unit. The unit has chosen Linux, because it's the world most widely used OS (even if not on desktops). So it's a vital component of a student's computing...
photo Re: can't install gcc in linux(Ubuntu) (all 5)
Tue 3rd Aug 2021, 6:20pm, Christopher M.
ANONYMOUS wrote: Wondering if you've been able to make progress with this problem? I've been unable to reproduce it, but it looks like updates could not be found and applied because VirtualBox was without access to the internet. Perhaps just a temporary/transient...
photo Re: Lab Questions. (all 4)
Tue 3rd Aug 2021, 6:15pm, Christopher M.
ANONYMOUS wrote: Sorry, forgot to add that this help2002 forum is also a recommended place to ask questions about the labsheets, workshops, and projects. It's the single place guaranteed to be read by our unit's teaching staff (and hopefully many other...
photo Re: Recommendation on Linux Installation (all 5)
Tue 3rd Aug 2021, 6:08pm, Christopher M.
ANONYMOUS wrote: Just in case you haven't seen it yet, there's a new link, in red, on the homepage's left menu describing the recommended options for installing Linux on students' common platforms. Still plenty to add, but plenty of reading there already....
photo Re: subtitles (all 6)
Tue 3rd Aug 2021, 6:06pm, Christopher M.
ANONYMOUS wrote: I did not consciously press anything to request transcription of Friday's workshop, so it may be set automatically depending on the venue?? Also, found this which may be of interest: https://www.uwastudentguild.com/blog/2021/07/26/lecture-transcription-service-faqs...
photo Re: Lab Questions. (all 4)
Tue 3rd Aug 2021, 1:04pm, Christopher M.
Yes, there will be sample solutions to all Labsheets, the Workshops, and the Projects. They will be released, via our Schedule page, *after* each respective event has been completed - e.g. the last weekly lab sessions are held on Fridays, workshops on Fridays,...
photo Re: Recommendation on Linux Installation (all 5)
Mon 2nd Aug 2021, 12:43pm, Christopher M.
ANONYMOUS wrote: The recommendations (which are not instructions) appear at the head of the Section 'Labsheet 1 tasks', on https://teaching.csse.uwa.edu.au/units/CITS2002/labsheets/labsheet1.php but they only point you in the right direction. As atated in...
photo Re: From Friday's tutorial. (all 4)
Mon 2nd Aug 2021, 12:40pm, Christopher M.
ANONYMOUS wrote: The 'obvious' response is that you may be able to attend the labs in the CSSE building, where Linux is installed and running on lab computers in Lab 2.03, but that will not work for everyone.
photo Re: From Friday's tutorial. (all 4)
Mon 2nd Aug 2021, 11:57am, Christopher M.
ANONYMOUS wrote: Can't give a definitive time, yet. It will likely be a list of instructions and links to follow, rather than a video, as there's too many combinations to consider (and you'll only be interested in one of them).
photo Workshop-2 is now available
Mon 2nd Aug 2021, 11:54am, Christopher M.
The question for Workshop-2 is now available from our Schedule page: https://teaching.csse.uwa.edu.au/units/CITS2002/workshops/workshop2.php All future Labsheets and Workshops will be llnked there, too, but won't be announced. At this stage, if you can...
photo Re: General Questions (all 4)
Mon 2nd Aug 2021, 5:14am, Christopher M.
ANONYMOUS wrote: Many textbook authors and writers on the internet will use the terms interchangeably, so it takes a bit of context to work out what's being discussed. Pedantically, they 3 are distinct things, so sorry if that wasn't clear from Friday's...

UWA week 30 - 2nd semester, week 1

photo Re: can't install gcc in linux(Ubuntu) (all 5)
Fri 30th Jul 2021, 3:13pm, Christopher M.
ANONYMOUS wrote: From where did you find that package name? I think it's correctly named here: https://linuxize.com/post/how-to-install-gcc-on-ubuntu-20-04/
photo Re: compiler (all 4)
Thu 29th Jul 2021, 2:29pm, Christopher M.
ANONYMOUS wrote: (a more descriptive Subject will help everyone out, particularly as the number of different topics grows) Whether using the Linux operating system natively (booted from its own disk partition), using Linux within some virtual environment...
photo Re: Program (all 7)
Wed 28th Jul 2021, 11:24am, Christopher M.
ANONYMOUS wrote: (this is pre-empting some of the discussion we'll have in Friday's workshop) There are 3 main contemporary operating systems used by our students - Windows, Linux, and macOS. Remembering that this unit is not just about the (very portable)...
photo Re: Program (all 7)
Tue 27th Jul 2021, 12:00pm, Christopher M.
Hello James, You're in the same situation as (guessing) about 90% of students in this unit - have some programming experience in other languages at an introductory level, such as Java or Python, but no prior experience in C. So on that point you have nothing...
This Page


Program written by: [email protected]
Feedback welcome
Last modified:  8:37am Nov 14 2021