Marquette University logo      

Questions from the Cards
Project 5: Priority Scheduling and Preemption

 

 

Will there still be a lab this Friday AND next Friday with the test being next week?

Yes. This one is worth it.

What chapters should we read for this assignment?

The chapters on "Processes" and "CPU Scheduling" are the most directly relevant.

Will we be implementing priority queues later on in our operating systems?

Yes, probably.

Is create easier to implement than fork? Why does xinu use create instead of fork?

Yes, it is easier to implement create() than a full fork(), and that is why we do it.

In the future for test cases like number 3 could TA bot output a possible output so that we could compare it to the one we got?

Yes.

I am a little confused about how the lock field is implemented in queue tab in order to keep the processes mutually exclusive.

I should have said in class: you do not need to worry about this yet.

-- Dr. D

1) Are there less than obvious test cases we should try on our context switch to make sure it works before we get our grade?

I assume this question has been rendered moot by the homework grades going out on Friday.

2) Which university did you enjoy working at most?

In all honesty, Marquette. The brightest students here are on par with the brightest I've worked with anywhere, and the average student is still a lot of fun to teach and to get to know.

3) Is there a disable() called by processes before they terminate to ensure no interrupts are thrown?

That disable() call is in kill().

4) What are your plans for v-day?

My wife loathes Valentine's Day, and prefers spontaneous romantic gestures that are not dictated by arbitrary cultural forces.

5) Have your children already built their own operating system?

Dexter is working on addition and subtraction. Ada is working on mashing peas into her hair. While that may *sound* like some of your classmates, I don't consider either of them ready for the lecture on activation records. Yet. :)

6) Why does the 4th process run 5 times?

It is being passed an argument that tells the loop to run 5 times.

7) How often does a Windows 7 environment switch processes?

askldjd.wordpress.com/2011/02/20/length-of-a-thread-quantum
Short answer -- looks like about every 5 milliseconds.

8) When do the files get uploaded normally so we don't untar previous years' projects again?

As soon as I have them ready, which is sometimes just before I leave Cudahy Hall to walk over to class on Fridays. If it helps, I'll move last year's files elsewhere so they do not lead you astray.

-Dr. D

1) Does the return value of prioritize() matter?

No.

2) Is there a sorting algorithm you would recommend implementing specifically for this assignment?

Insert the item at the correct location in the already-sorted list.

3) Why did we choose priority scheduling for Xinu?

Cheap and effective implementation.

4) The assignment specification requires us to demonstrate when aging is false and when it is true. Do we set the value of AGING to false in test code?

No, the AGING constant must be changed in kernel.h and recompiled.

5) Why do you have an isabadpid() and isabadqueue() check in enqueue(), but if we add these to our prioritize(), it fails our tests? Is it simply for easier testing and the ability to create pids and queues?

If the isbadqueue() is failing the safety check, you've probably not increased the allowable number of queues in the system, (see NQENT #define in queue.h,) or you haven't allocated a queue properly, (see newqueue() in queue.c.) Do not ignore this error - the safety check is telling you something important is broken!

If isbadpid() is failing the safety check, you're either using an invalid process ID, or your process is in the PRFREE state. The latter is an innocent mistake to make in testing, but realize that a PRFREE process is free to be allocated by other entities in the system at any time, which could cause embarrassment and/or failed testcases. You probably want to "claim" a process ID before using it in a testcase, either by calling create(), or by setting the PCB state variable to PRSUSP directly.

-Dr. D

 

1) Can you show how to setup a shared directory?

I can outline the steps here.

First, get a shared UNIX group. You do this by e-mailing me the login names of yourself and your partner. You will get a response back along this lines of, "you will be group os03". You can check that your group is setup correctly from the UNIX command line with

	getent group os03
which will respond with something like
	os03:*:60007:pschmans,lbelcher,tech
showing that Phil and Lucas are in group os03. The account "tech" appears in all of the class groups, and is our system administrator.

Next, make a directory to share between the group. One of the partners will host the shared directory in their account, but both will be able to access it. For example, I could say 'mkdir sharetest' in my home directory. Use the 'chgrp' command to change the ownership of this directory. For example, 'chgrp osdev sharetest', would change the group ownership of folder sharetest to the group osdev, which I happen to belong to. Confirm this with 'ls -l':

	drwxrwxr-x.  2 brylow osdev     4096 Feb 18 14:25 sharetest
The directory is now owned by me and group osdev. The directory is also world-readable. Change that with 'chmod o-rwx sharetest', and run 'ls -l' again:
	drwxrwx---.  2 brylow osdev     4096 Feb 18 14:25 sharetest
This directory is now readable, writable, and executable by me and anyone in the osdev group, but not everyone else.

There are still some tricky problems that come up with a shared directory like this. It is easy for me or my partner to create new directories or files within this shared directory that are *not* owned by the group, and then we'll have to be careful to use the chmod command again whenever this happens.

UNIX provides an easy solution for this, called the 'setgid' bit. Run 'chmod g+s sharetest', and 'ls -l' now returns:

	drwxrws---.  2 brylow osdev     4096 Feb 18 14:31 sharetest
The 'x' permission bit for the group has changed to an 's', indicating that directories and files created under sharetest/ will by default inherit the shared group id.

There can still be problems when multiple users are actively reading and writing to the same group of files. (See: race conditions!) This is why we recommend using your shared directory to host a version control repository, such as subversion, to collaborate on projects with a partner or group.

2) Could you always speak out loud the names of the files that you are opening? I sometimes can't read the file name before the file contents are on the screen, which makes the code slightly more difficult to grasp due to less context?

I will make an effort to speak the names of files as I open them. Also, for ease of reading, all of the files in our O/S identify themselves in a comment block at the top of the file -- so you can watch for that on the screen if you miss me saying which file I'm opening. Don't be shy about asking me where we are if I'm going to fast in class.

3) Does "you have 2 weeks to implement priority scheduling" mean that you expect it to take 2 weeks, or just that we have extra time due to the test.

I expect it to take you one week, and you have extra time because of the test.

4) What happens if you don't implement an interrupt after resched()?

Not sure what is meant by "implement an interrupt" in this question. I'll take a stab at what I think it is asking. If you do not restart the clock timer after a clock interrupt causes a resched() on our MIPS architecture, then there will be no subsequent timer interrupt, and you will no longer have preemption.

5) What does 'critical section' mean?

This term is defined in section 5.2 (9th edition) of your text, "The Critical-Section Problem". When a process is executing a critical section of code, no other process should also be executing a critical section. Thus, when we enter a critical section, the O/S needs to take steps to ensure that no other process gets a chance to enter a critical section.

6) Every time we create() a process, does the process have their own timer in order to keep track of its waiting time?

On our MIPS architecture, there is only one set of timer hardware that is shared amongst all of the processes.

 

 
  Marquette University. Be The Difference. Marquette | Corliss |