hatfield-c / xv6-project2

The second project for the xv6 operating system. Must replace the Round Robin scheduler with a lottery scheduler.
1 stars 0 forks source link

[LOT-4] A process can set its tickets with a system call #4

Closed hatfield-c closed 6 years ago

hatfield-c commented 6 years ago

A system call titled "settickets(int)" will be created. This system call receives an integer as an argument, and sets the number of tickets for the process that called it equal to the argument. It will return a 0 if successful, or a -1 otherwise.

The biggest hurdle to overcome, is determining the exact mechanism that the data contained within the process's proc structure can be accessed, set, and saved within the system call. Theoretically, the context does not change when the system call is instantiated, however due to the nature of a system call, it will try to interrupt its way into kernel space, which might cause some unwanted context switching to occur. If this is the case, we will need to devise a more sophisticated means of passing the reference to the number of tickets into the system call, however much more experimenting must be done before we can determine the exact nature of this.

hatfield-c commented 6 years ago

I have been able to set up the system call successfully, and can pass information into it as well. I can also access the ticket number of a process within the system call, but I have yet to confirm if it is the same process that utilized the system (that is, I have not confirmed persistence of data yet).

I will try outputing the PID of process that instantiates the syscall, followed by its associated ticket number as well. If these match up, then we have confirmed persistence. If not however, then we will need to examine how we can enable persistence (possibly via a pipe).

hatfield-c commented 6 years ago

I have confirmed that it is the same process context within the system call as it is within the user program - the PID's match up, and thus so do the number of tickets across calls. As such, all that remains is to clean up debugging code.

hatfield-c commented 6 years ago

This issue is now complete, and is available on the branch LOT-4. Please QA on that branch, and have a nice day. :)

hatfield-c commented 6 years ago

This issue has passed QA, and the branch LOT-4 has been merged with master.

hatfield-c commented 6 years ago

This issue will now be closed.