It's UWAweek 49

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.
58 articles posted by this person
Showing 58 of 1168 articles.
Currently 2 other people reading this forum.


 UWA week 42 (2nd semester, week 12) ↓
SVG not supported 12:16pm Mon 16th Oct, Jacob R.

Just a quick clarification with the second part. This won't be tested, right, as it was specified that files with the same name will never have the same modification time.


SVG not supported 1:29pm Sun 15th Oct, Jacob R.

Precisely. With -a not provided, any file with a . before it is ignored. With -a provided, the files with . before them are considered to be synced (but obviously still need to satisfy only and ignore patterns, if provided). And '.' and '..' should a...


 UWA week 40 (2nd semester, week 10) ↓
SVG not supported 12:56pm Sat 7th Oct, Jacob R.

If syncing recursively and subdirectories are empty, will those subdirectories still be made in the other directories being synced. I assumed this, as testing for subdirectories being empty and only syncing them if not would add a layer of complexity...


SVG not supported 1:21pm Tue 3rd Oct, Jacob R.

Ok, thank you. That greatly simplifies things, and I appreciate the effort to answer each question. I was mainly unsure about edge cases, but it seems the syncing is fairly shallow. And obviously in finding the masterfile, the program can be terminat...


SVG not supported 8:01am Tue 3rd Oct, Jacob R.

Of course. I'm using recursion to move through and create subdirectories if necessary, and then running the sync directories function on those subdirectories. The main point was there become problems if there is a subdirectory that shares the name of...


SVG not supported 1:01pm Mon 2nd Oct, Jacob R.

Of course. I'm using recursion to move through and create subdirectories if necessary, and then running the sync directories function on those subdirectories. The main point was there become problems if there is a subdirectory that shares the name of...


SVG not supported 4:07pm Sun 1st Oct, Jacob R.

If the program is syncing both files and directories (so it's being called recursively), what happens if in one directory a file is called "thing1", but in another directory, a sub-directory is called "thing1" as well. Obviously these can't be direct...


 UWA week 39 (2nd semester, week 9) ↓
SVG not supported 2:13pm Wed 27th Sep, Jacob R.

When trying to sync files between two locations, how do we determine whether one file should overwrite another? There's obviously the base case, where you just change the contents of a file "thing1" and simply overwrite its copy in the other director...


 UWA week 36 (2nd semester, mid-semester break) ↓
SVG not supported 2:06pm Sat 9th Sep, Jacob R.

So the start of the screenshot is a process going to sleep for 15usecs (coming off the CPU) which means it's now in IDLE. At the start of IDLE it unblocks all sleeping processes, which is PID6, and moves that to ready (note that it only unblocks the ...


SVG not supported 8:18am Sat 9th Sep, Jacob R.

The CPU moves to IDLE every time a process finishes its timequantum or executes a syscall (after moving the process). It then executes in the order of these steps unblock any sleeping processes unblock any processes waiting for all their spawned proce...


SVG not supported 8:15am Sat 9th Sep, Jacob R.

I mean the maths is right, but it's in bytes per second, so it's 0.0006666.... seconds. Which 666.6666... usecs. Which is how time is measured. This is always rounded up.


SVG not supported 11:12am Thu 7th Sep, Jacob R.

Don't use vscode to add tabs. Use notepad or something. Like those are definitely tabs. Should look like this shortsleep 10usecs sleep 1000000usecs 50usecs exit


SVG not supported 9:39am Thu 7th Sep, Jacob R.

A process is a child process if it's a process that was spawned by another process (anything other than the first process) 1. No, you don't need to call wait after spawn, but wait means the current process will wait for all of its children (if it has ...


SVG not supported 9:37am Thu 7th Sep, Jacob R.

Every syscall effectively takes one extra usec to run, after the time it requires on the CPU. So this is where the extra usec comes in. So just implement it before every syscall occurs. And then for your issue with sleeping, it went to sleep at 16, s...


SVG not supported 8:53pm Wed 6th Sep, Jacob R.

You need to tab out your lines as well. Not just the ones I did. So everything needs to line up with the syscall lines I did for you


SVG not supported 8:42pm Wed 6th Sep, Jacob R.

This now has tabs before the syscalls. So should work. Just need to do the same. As in delete the spaces and just press tab.


SVG not supported 8:41pm Wed 6th Sep, Jacob R.

I mean I don't know if this forum formats stuff, but they aren't tabs if I paste them into notepad shortsleep 10usecs sleep 1000000usecs 20usecs spawn longsleep 50usecs exit


SVG not supported 5:36pm Wed 6th Sep, Jacob R.

No, the wait syscall doesn't automatically have to be added after a spawn syscall. Although if you want it to actually wait, then you'd have to do it after a spawn, otherwise it wouldn't have any children. Well it doesn't really say much in the proje...


SVG not supported 4:48pm Wed 6th Sep, Jacob R.

Yeah, directly after spawning, the process that called spawn will move from RUNNING to READY. But when it gets back onto the CPU, if it then calls WAIT, it will move to the WAITING state. WAITING is a form of BLOCKED wherein it's a process waiting fo...


SVG not supported 4:30pm Wed 6th Sep, Jacob R.

Is there anything attached? It might be because you're not using tabs in between the start of the line and the syscalls (make sure they're tabs and not just 4 spaces)


SVG not supported 2:43pm Wed 6th Sep, Jacob R.

Any syscall seems to take 1usec of system time to like actually execute (as in it's saved up the time to execute on the CPU, but then it takes 1 extra usec of system time off the CPU to carry it out. Shouldn't be too hard to implement.


SVG not supported 12:44pm Tue 5th Sep, Jacob R.

Yay Let's go Surely we can compare like certain outputs at some point. Because I don't know when the sample solution will get fixed.


SVG not supported 12:42pm Tue 5th Sep, Jacob R.

Yeah... The new clarifications make it so that it has to go back into ready at the end of its timequantum, even if there aren't any other processes in ready.


SVG not supported 11:11am Tue 5th Sep, Jacob R.

Something tells me there might be some overflow in the sample solution. The timing definitely shouldn't be negative. This is using readCmd 200usecs read hd 48000B 250usecs exit Along with the normal sysconfig devicename rea...


SVG not supported 11:03am Tue 5th Sep, Jacob R.

For the final percentage, in the sample solution it doesn't seem to be rounded at all and is just cast direct to an int. Should we do the same?


SVG not supported 10:47am Tue 5th Sep, Jacob R.

Yeah, I mean I have unsigned long long int temp data (unsigned long long int) syscall- data 1000000; Multiply the data by 1000000 so it can work with microseconds. Surely this doesn't get taken down because it's just casting and multiplication...


SVG not supported 10:28am Tue 5th Sep, Jacob R.

Make sure you have a tab between the start and 4usecs.


SVG not supported 10:27am Tue 5th Sep, Jacob R.

Ah, ok... Yeah... I mean floats are inaccurate, so dividing large numbers that should divide perfectly may not work. Do you use mod at all, then?


SVG not supported 10:20am Tue 5th Sep, Jacob R.

Yeah, I'm also going to just add 1usec. As I don't increment by 1usec anyway. I try to increment to the next event that will occur to make it more efficient. I mean your method sounds pretty good, as it does just seem to add 1usec each time for a sys...


SVG not supported 10:11am Tue 5th Sep, Jacob R.

Also, another problem there might be with the implemention of READ and WRITE. So if the division would return a float (say 33.3 recurring), it obviously needs to be converted to an integer as the system time is fully based around integers. Now I beli...


SVG not supported 10:02am Tue 5th Sep, Jacob R.

Amen... Just waiting for further clarifications from him for other stuff. And I also wanted to check with you. So when a syscall is called, are you just assuming that it would increment the system time by 1, as it seems to take 1usec for each syscall...


SVG not supported 9:56am Tue 5th Sep, Jacob R.

Yeah, that was definitely the assumption he made. That it was based on them both waking up at the same time, and the one that had been sleeping for longer (5000usecs) would have therefore called the sleeping syscall first and would then wake up first...


SVG not supported 9:46am Tue 5th Sep, Jacob R.

Sorry for grammar issues. But based on this quote "You first unblock any sleeping processes that finish at the current time. If there are multiple such sleeping processes, they are unlocked in the order in which they started sleeping." It's only if th...


SVG not supported 9:43am Tue 5th Sep, Jacob R.

Yeah, the first one is also an issues I've encountered, and is definitely incorrect. The second one isn't an issue and just an interpretation issue. It's if both processes needed to wake up at the same time. The one that had called sleep first would ...


SVG not supported 9:39am Tue 5th Sep, Jacob R.

Based on the sample solution, it seems to wake a process up from sleeping, and if in waking something up it needs to wake another process due to the state transition, it then wakes it up.


SVG not supported 9:30am Tue 5th Sep, Jacob R.

I guess another question is whether a sleeping process would wake up if the state transitions from other processes changing state took it to its wake-up time, or if it would still just move onto the next ready process (based on the hierarchy being in...


SVG not supported 9:25am Tue 5th Sep, Jacob R.

Yeah, that would make sense, although it's just that taking something out of sleeping would require a state transition, which would increment the time by the 10usecs, so I guess I'd have to keep a temporary variable to record the current time to see ...


SVG not supported 8:35am Tue 5th Sep, Jacob R.

If a sleeping process and a waiting process should wake up at the same time (so the sleeping process wakes up first), but in waking up, the sleeping process advances the time so that another sleeping process should now wake up, would this sleeping pr...


SVG not supported 5:03pm Sun 3rd Sep, Jacob R.

Yeah, so with the commands file, a process is created and runs the first command in the file (shortsleep in this case), with the other commands in the file being possible commands that could be called by the first command (or any processes that the f...


SVG not supported 12:03pm Sun 3rd Sep, Jacob R.

I mean there are problems with the sample solution, but that isn't one of them. The scheduler should only run the first command in the commands file, so unless that command calls spawn, only one process will be run.


 UWA week 35 (2nd semester, week 6) ↓
SVG not supported 11:02am Thu 31st Aug, Jacob R.

Yeah, of course. I just know some people really dislike global variables within programs and will actively try to get rid of them at the expense of readability. As it is, I've used a struct containing double pointers instead of global variables for t...


SVG not supported 3:38pm Wed 30th Aug, Jacob R.

No, otherwise nothing would ever be spawned. Only the first command is run, so if spawn is to be a valid sycall, it must be able to refer to commands after. Also, this has been answered by Chris previously.


SVG not supported 9:43am Wed 30th Aug, Jacob R.

For project 1, would you rather we pass multiple pointers to all of our functions instead of using global variables, or are you ok with global variables if the scope of the variable is almost global or global. The pointers approach can obviously make...


SVG not supported 7:48am Tue 29th Aug, Jacob R.

I'm still unsure when the state transition would occur, though. Like from RUNNING to BLOCKED or READY would be easy to implement, because the process is already on the CPU, but if it's moving from BLOCKED to READY, then when would this be executed on...


SVG not supported 7:33pm Mon 28th Aug, Jacob R.

I just wanted to clarify something. Does every state transition that occurs instantly takeover the CPU to perform the state transition, or would it enter the ready queue? I read elsewhere that state transitions require the CPU, so does this apply to ...


SVG not supported 12:15pm Mon 28th Aug, Jacob R.

Ok, great That definitely clears it up a lot Thanks Yeah, so mine just does integer division now and adds one if it doesn't divide completely. So using a completely quantised approach now.


SVG not supported 10:22am Mon 28th Aug, Jacob R.

Yeah, this is basically the same thing that I was discussing and was unsure about. Attached is my implementation using the example file, and the sample.


SVG not supported 8:12am Mon 28th Aug, Jacob R.

Ok, yeah, that definitely clarifies the situation with time, and should be relatively easy to change in my version, so thanks. It obviously raises some questions with if it's trying to sleep for less than the time it takes to switch states, at which ...


SVG not supported 1:08pm Sun 27th Aug, Jacob R.

Also, another question is when performing IO, the amount of time it takes is often not an integer, so should this just be rounded and then added to the system time as an integer, or should it be rounded up consistently, or should the system time be a...


SVG not supported 12:49pm Sun 27th Aug, Jacob R.

I have some questions about the sample solution for myscheduler. When sleeping a specific process, it doesn't seem to take into account the 10 microseconds required to move the process from running into blocked, before sleeping. Should we also not ac...


 UWA week 34 (2nd semester, week 5) ↓
SVG not supported 11:22am Wed 23rd Aug, Jacob R.

You could, yeah, because the syscalls used by the commands are completely constant and can take no other name. And each syscall function you hardcode could move your processes between queues. Like to a sleeping queue or an IO queue for a specific dev...


SVG not supported 11:14am Wed 23rd Aug, Jacob R.

So yeah, the commands file will contain the commands and the syscalls that each command calls. But you don't know what the commands and syscalls will be, so you can't hardcode them. You have to actually read the command file and implement the specifi...


SVG not supported 11:10am Wed 23rd Aug, Jacob R.

You can't hardcode the functions as the command names might change, or the syscalls and their arguments could change for every command file being passed as an argument. Like shortsleep might be called nap, and might sleep for half of the time, or als...


SVG not supported 10:57am Wed 23rd Aug, Jacob R.

You'd have to read the command file in the read commands function where the file is passed as an argument to the function. You could then put your commands into an array based on your parsing of the command file, and in the execute commands function,...


SVG not supported 10:48am Wed 23rd Aug, Jacob R.

So yeah, you'll need to read the specific syscalls for each command


SVG not supported
1st project  ✅ Project Question 👍x1  (all 14)
10:45am Wed 23rd Aug, Jacob R.

Pretty sure we're not actually implementing the functions. We're just emulating them. So we don't need to call actual functions, we're just transferring them between queues and pretending to run them, which takes time on the "cpu". But we're just cou...


 UWA week 33 (2nd semester, week 4) ↓
SVG not supported 3:01pm Mon 14th Aug, Jacob R.

Update I may have found a partner, although will keep this thread updated.


SVG not supported 9:09am Mon 14th Aug, Jacob R.

I'm currently looking for a project partner for the first project. I am studying a bachelor of Advanced Computer Science, majoring in Artificial Intelligence. I have only done one programming unit, Python, although I have slight experience in other l...

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  5:07AM Sep 06 2023
Privacy policy