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...
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 ...
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...
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.
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
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 ...
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...
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
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...
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...
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)
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.
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.
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...
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...
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...
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...
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...
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...
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...
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 ...
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.
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...
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 ...
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...
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...
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.
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...
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.
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...
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...
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 ...
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.
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.
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 ...
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...
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...
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...
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...
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...
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,...
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...
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...