CO527 Anonymous Questions and Answers |
This page lists the various questions and answers. To submit a question, use the anonymous questions page. You may find the keyword index and/or top-level index useful for locating past questions and answers.
We have taken the liberty of making some minor typographical corrections to some of the questions as originally put. Although most of the questions here will have been submitted anonymously, this page also serves to answer some questions of general interest to those on the course.
Submission reference: IN5156
Why is the range of possible registers limited for certain instructions?
I do not know how to answer this, I have looked through my notes but nowhere does it say why; all I found were "ldi is used to load an immediate value (specified in the instruction encoding) into a register (limited to r16–r31)" which does not tell me in why the range is capped. Thanks.
The bit of knowledge you need here is that most instructions are encoded as 16-bit words (i.e. each instruction is 16-bits "wide"). For something like the "ldi" instruction, 8 of these bits are necessarily used up by the value being loaded, leaving 8 bits in which to encode (a) the fact that this is a load-immediate instruction and not something else, and (b) the register the value is being loaded into. That's pretty tight, and in fact, too tight, so to make the encoding scheme work only four bits are available to store the register number. Consider whether this would be a problem for the AVR if every instruction was encoded in 32-bits, not 16, which it has to do in practice for certain kinds of absolute jump/call.
Submission reference: IN5154
Hi Fred, could you please provide an answer for question 1 on the 2014 past paper please? Thanks.
I'll go part way to some solutions, hopefully enough to put you on the right track at least.
Q1(a) is 10 marks based on the machine architecture material, with some focus on low-level programming. Essentially you have to be able to understand what this program fragment (function/procedure/method) is doing. Looking at the code:
If this were a C or Java function/method, its prototype would look something like:
int thing (int input);
Although "int" isn't quite right for the 8-bit AVR. Looking in a bit more:
The middle 6 lines of assembly are the "meat" of the function. Starting at the top:
In answering part (i) of the question, you essentially need to trace this code through: rough working. The first time at label 0, we have r16=0 and r17=3. Two lines later, r16=0+3=3 and r17=2, and the zero flag not set, so the branch following is taken to repeat the code. Next time around, r16=3+2=5 and r17=1, and again, r16=5+1=6 and r17=0, but now the zero flag is set so the branch is not taken and the function returns with r16=6.
Part (ii) is understanding what is actually being computed here. If you managed to get through part (i) then expressing this (in words) should not be to difficult: think sum from 1 to N.
Part (iii) does not require the other two parts to have been correct, nor the code to have been understood fully even. This is an example of a fairly standard question, thus it has a typically textbook answer. However, memorising that isn't necessary, as there's enough information in the question, if you can make the link between the phrase "calling convention" and the idea that this is related to the convention used when calling procedures/functions. The comments in the code talk about parameters passed into the function and results returned — essentially how this happens is the calling convention. The extra bit is related to whose responsibility it is to save registers that are used by functions like this — the caller or the callee. A reasonable textbook answer would be "the way in which functions/procedures are called, how parameters are passed, how results are returned (and whose responsibility it is to save trashed registers, caller or callee).".
Part (iv) asks about the specifics of the calling convention in the example. As evident (mostly): parameters are passed in registers, results are returned in registers, and it's the callee's responsibility to save trashed registers.
For Q1(b) part (i), non-determinacy refers to something that "is not capable of being determined" (in advance). In a more OS context, it is related to events (things happening). The question suggests that this feature/characteristic is desirable (a good thing): putting these together, what might this feature/characteristic be?
For Q1(b) part (ii), there are two different scenarios to consider (very short or very long time-slice timeouts). You need to have some understanding how OS processes and time-slicing work, i.e. processes that continuously "hog" the CPU (without interacting with the OS, as a video encoder / data analysis / etc. tools might do for chunks of time) are forcibly stopped by means of this time-slice timeout. You also need to know that the act of context-switching itself (or at least interrupting a running process) will cost some CPU time — should be obvious. For the very short timeout, consider the ratio of interrupt/context-switch time to useful-computing time. For the very long timeout, consider the user experience.
For Q1(b) part (iii), consider that the traditional PC boots in real (16-bit) mode, and can only access the first megabyte of RAM. Also consider that things like USB host-controller interfaces or SATA/AHCI interfaces are usually presented in the system as PCI devices, and where in the 32-bit memory world those PCI devices are accessed.
For Q1(c), we didn't cover in detail parts (ii) and (iii).
Submission reference: IN5153
Just a quick question in the previous papers questions have been asked about the process control block and paging also semaphores but they don't appear in any of the lectures given this year. Was wondering if this is due to change in Staff therefore leading to a change in the structure of the course or that we are required to look at and recall information from CO324 as well. Thank You
Process control blocks and semaphores were indeed not covered. Virtual memory (and hence pages) were covered: lecture notes.
Don't forget: The exam questions are similar to the ones in the lecture notes that are marked by a ►.
You are not required to look at CO324. (But, it would be a pity if you can't recall that material already.). Update: whilst CO324 is not directly examinable in that sense, CO527 builds on it, so you are expected to know/understand the material that was taught there as it is a pre-requisite for CO527.
Submission reference: IN5148
You mentioned before about previous year papers being capped as there is a lot of content. Will this be the same this year?
No — unfortunately having the mark capped (i.e. 50 marks available in 5x 10-mark bits, capped at 40) did not benefit students as much as I had intended, and was also frowned upon as being unusual and out-of-line with the normal way exams are structured.
Submission reference: IN5145
Hi Fred. I was wondering if because we had a different lecturer for the 2nd half of the module for this year as Bob has left, are the questions in the previous papers still relevent for revision?
For example, I have not seen any quantitative questions in previous papers, and find these difficult. Would I be able to do well on the exam given that I find those questions difficult but can do the other types of questions.
I understand that you may not be able to answer this question due to it being about the exam.
The questions from the half of the exam on operating systems are most similar to those marked by black triangles in the lecture notes. Some of those questions are solved in the slides; others were solved only in the lectures. For the operating systems part, the primary focus of your revision should be the lecture notes. You can and should use other materials, like the old exams.
Submission reference: IN5147
Can you provide any help on solving this question from the 2014 exam paper.
"Describe the operation of the register file, including how the various control and data signals are involved."
This isn't a question that is "solved" in any sense. To answer it, you need to understand what the register-file is used for, how it is used, and how it interacts with other parts of the architecture. Once you have that understanding, answering the question should be relatively straightforward. If you don't understand this, the question will be hard. Best case, make an educated guess based on what information is provided in the question, but don't attempt to re-phrase the question into the answer (that will not get any marks).
Submission reference: IN5146
Do you know where I can find a bunch of information on pipelining?
Any decent machine architecture book, Google, etc.
Submission reference: IN5141
When will we get our marks for A4 - Systems programming and A5 - File Systems?
By the advertised dates: end of week 25.
Submission reference: IN5136
with the previous assessment( the disk scheduler) we learnt how a normal HDD operates using the disk scheduling algorithms i was wondering what does a SSD use for an algorithm as none of the algorithms used on a standard HDD would work as there are no moving parts
thanks
Linux doesn't have any scheduling algorithm specific to SSDs. Debian has a webpage on configurations to do if you have an SSD. It recommends not to use CFQ, but either Deadline or Noop. Noop does what the name says: nothing. That is, it serves requests in the order they come. Deadline tries to minimize the maximum delay (like a real-time scheduler which, oddly enough, will feature in tomorrow's lecture). But, if you look at the source of Deadline (block/deadline-iosched.c in the kernel) you'll see that it talks about rotations, cylinders, and so on. In other words, Deadline isn't really written for SSDs either. The reason to prefer Deadline, is that with no scheduling at all it is easy for one process that copies a huge file to strangle the I/O of all other processes.
Briefly, with SSDs, scheduling should look more like the scheduling for network traffic. Alas, Linux doesn't implement that yet. No idea about Windows.
Submission reference: IN5138
Hi, I'm trying to do the quanatitative questions that were supplied with the Filesystems lecture notes.
So far I think I understand the bitmap description, that to find the number of blocks needed for a bitmap you can calculate 2^(num blocks)/2^(bytes per block). However I think I must be misunderstanding this somewhere.
The question I am trying to work out is: Consider a file system with 10^6 blocks, each of 1024 bytes: k blocks are reserved for a bitmap that tracks which data blocks are in use; the other 10^6-k blocks are data blocks. What is the maximum value of k?
Basing my answer on the example in the notes, I calculate (2^(10^6))/(2^(1024*8)), but I don't understand why it is 2^x rather than some_other^x. I think the way I work it out is wrong because of the value that the calculation gives (which approx is 1.0799122323513257560661326310388669794800103439001... × 10^303496).
I'm guessing that I am going wrong when chosing which value to put to a power (ie 2^x or 10^x).
Please could you push me in the right direction?
Thanks
So far I think I understand the bitmap description, that to find the number of blocks needed for a bitmap you can calculate 2^(num blocks)/2^(bytes per block). However I think I must be misunderstanding this somewhere.
The formula 2^(num blocks)/2^(bytes per block) is incorrect. The number of bits you need for the bitmap equals the number of data blocks. Once you know the number of bits, you can find out in how many blocks those bits fit, by dividing to the number of bits in a block.
The question I am trying to work out is: Consider a file system with 10^6 blocks, each of 1024 bytes: k blocks are reserved for a bitmap that tracks which data blocks are in use; the other 10^6-k blocks are data blocks. What is the maximum value of k?
We did this problem in the first rescheduled lecture, which many students couldn't attend because of a test. Solution:
So, the answer is 123.
OK, so how did you get the wrong formula from the lecture notes? You made two mistakes. First, when the notes say ‘consider a file system with 2^n data blocks’ that means that the number of data blocks is 2^n, not n. So, in the problem above, we have 2^n=10^6. And second mistake, you didn't pay attention to the difference between bits and bytes.
[UPDATE: The exercise should ask for the minimum value of k, not the maximum. (There is no maximum. Or, rather, the maximum is trivially 10^6.) I'll update the lecture notes. Thanks for this question.]
Submission reference: IN5135
Hi, Would it be possible for you to supply some additional materials for us to learn and practice the maths based questions which are in Radu's lectures? I don't feel prepared for the exam and feel that extra resources (e.g. more examples on how to answer a question) would help a lot.
Most of the quantitative questions are from Modern Operating Systems by Tanenbaum, which can be found in the library and has a lot of additional material. You can also ask here if you have a specific question about a specific exercise.
Submission reference: IN5134
Hi I'm trying to find all blocks of file BAR for question 8 but I keep hitting blocks with just zeros. Can you tell me where I'm going wrong please? This is my calculation so far:
[... some calculations ...]
I'm sorry, but I don't understand at all what you are trying to do. Perhaps the recent answer to Question 83 (2015) will be helpful?
Keywords: assess5-1516
Submission reference: IN5133
This is my attempt on question 8 which I would like feedback on the explanation to see if I am right or wrong on my calculations.
[... An attempt at Q8. Snippets are quoted in the answer....]
What we know : start of cluster 000a -> 0x10
What does this mean? '000a' looks like it might be a a hex number because of the 'a', although there's no clear '0x' to indicate so. The number 0x10 is clearly in hex, because it's marked by 0x. So, rewriting "000a -> 0x10" in the more familiar decimal notation we get "10 -> 16". What does it mean?
Well, … obviously, I can guess what it means. You meant to convert the hex number 0xa to the decimal number 10. But the way you write numbers is very confusing, and you will get confused if you don't keep the separation hex/decimal straight.
so 0x10+0x2B = 0x0035
Really? I thought 0x10+0x2b = 0x3b, because 0x0+0xb is 0xb, no carry; and 0x1+0x2=0x3, again no carry. Notice how I'm using the normal addition algorithm, going digit by digit from right to left.
But, again, I guess you actually mean 10 instead of 0x10. So the operation is 10+0x2b. I don't know how to compute that because it mixes bases, so I'll convert to the same basis. (a) Let's try decimal: 10 + 2*16 + 11 = 21 + 32 = 53. (b) Just for fun, let's double check if we get the same answer in hexadecimal (we should!): 0xa + 0x2b = 0x35. How do I know that? Well, 0xa+0xb=0x15, so 5 with a carry of 1; and 0x2+0x1=0x3. (How do I know that 0xa=0xb=0x15 you ask? The same way I know addition between single digit numbers in decimal: I count on my fingers. Or I remember it. But, in this case, I used fingers.) Is 0x35 the same as 53? Let's see 3 * 16 + 5 = 48 + 5 = 53. Yes.
If I ignore the very confusing mixup in notation between decimal and hexadecimal, there is no mistake so far.
000a in binary form to attempt the 12 bit conversion
No. You don't need to convert 0x000a to anything. You just need to find the 11th group of 12 bits in the FAT table. (11th, because it's at index 0xa=10, and we start indices from 0, as usual; See also Question 74 (2015))
Here this is a bit tricky because of endianness. So, let's say, hypothetically, that the content of the FAT table is the following:
0x00 0x01 0x02 0x03 0x04 0x05
The way to think about this is that bits are in little endian order:
00000000 10000000 01000000 11000000 00100000 10100000
Now we regroup these in groups of 12 bits:
000000001000 000001000000 110000000010 000010100000
And now we read them as numbers, using the same endianness convention (which means we swap left-and-right again): 0b000100000000, 0b000000100000, 0b010000000011, 0b000001010000. And, back to hex: 0x100, 0x020, 0x403, 0x050. So, for example, the third entry in this FAT12 table is 0x403.
If you look carefully at all the left-right bit-flipping above, you'll see that groups of four bits never get split, and you get the algorithm from this page, which I already mentioned in Question 74 (2015). (And it is the algorithm you tried to apply to 0xa, which is incorrect.)
Two questions: 1) Is my working correct?
The first serious mistake is that you try to shuffle the bits of 0xa, which you shouldn't, as I said above. But the computations that come before, although ending up with correct answers, are not properly saying in which base you are working.
2) the hexadecimal values i found must be converted to 12 bit as well right, since they are FAT entries?
You don't need to find a 16bit value and then convert it to a 12bit value (whatever you may mean by "convert" …). FAT entries have 12 bits; you just need to find the 11th FAT entry (and then repeat, as explained in Question 74 (2015)).
Keywords: assess5-1516
Referrers: Question 84 (2015)
Submission reference: IN5132
Is any of these questions going to be in exams?
Maybe. It depends on what you mean by "these questions".
If you mean the questions in assignment 5, then no.
Submission reference: IN5131
Probably overthinking this but is (size of FAT)*(number of FATs) + 1 the correct formula to use to find the number of blocks in the file system?
In the tutorial it states that this is the number of blocks that appear before the root directory, this doesn't seem right for the entire file system.
Also in the tutorial, it states that reserved blocks are on the disk but not actually part of the file system, so in this case would it not be better to look at the number of blocks occupied by one copy of the FAT and then times that by 2?
By doing so, we're looking at blocks that are being occupied rather than just empty, is this what is needed?
You need to find the total number of blocks, not the number of used blocks. The tutorial tells you how to do so.
Submission reference: IN5130
I'm stuck on Q3.
[... some wrong arithmetic ... ]
Can you please advise me where I have gone wrong?
See Question 78 (2015) and Question 72 (2015).
Some details:
Keywords: assess5-1516
Submission reference: IN5129
For question 8 of the FAT assignment, do we need to order the blocks in how they are found or order them based on the block number i.e. if u found block 200 first in the FAT then the next cluster takes u to 180, would u write it down as block 200,block 180 or block 180,block 200.
Thank you very much!
200, 180
Keywords: assess5-1516
Submission reference: IN5128
If the way of working out where a root directory appears is by doing
(size of FAT)*(number of FATs) + 1
[... some wrong multiplications ...]
You need to be able to do multiplications correctly for this assignment. Stay with decimal numbers if that's what you feel more comfortable with. You can also do multiplications using a calculator. For example:
rg@rg-2016:temp$ python3 >>> 0x08 * 2 16 >>> hex(16) '0x10'
See also Question 72 (2015).
Keywords: assess5-1516
Referrers: Question 80 (2015)
Submission reference: IN5123
Here is my solution to question 8, I followed the tutorial given but keep on ending up at a blank block!
[...]
Max. number of entries in root directory: 0x0002 =-> 2 entries.
[...]
One problem is that the maximum number of entries in the root directory is not 2. This should be obvious, since question 3 asks about the 5th entry. Two is less than five, so alarm bells should ring.
Your solution has many other mistakes. Some of these mistakes are irrelevant to question 8 (for example, the file size is wrong), and some of these mistakes come after the mistake I called out above. In any case, you need to slow down, and go through the tutorial carefully.
Keywords: assess5-1516
Submission reference: IN5121
I've been reading Bob's guide in how to find the next cluster of a file in however it is not getting me anywhere. Here is my working out, please could you point me in the right direction.
[...]
Keywords: assess5-1516
Maintained by Fred Barnes, last modified Wed May 25 15:07:19 2016 |