XML

kent logo

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.


Question 41:

Submission reference: IN2894

This is a follow up of Question 39 (2013). Which way will the current flow if there is a fork?

Answer 41:

It depends.. In the case of the inverter, current will flow either in or out of the "out" connection, depending on whether the inverter's input is 0 or 1. Usually this would be connected to the gate of another FET, in which case the current involved is very small (because the gate terminals are mostly insulated in a FET — the transistor works on field effect rather than current amplification like a BJT). If that wasn't what you meant, can you draw a picture? (ASCII art will do!).

Keywords: electronics


Question 42:

Submission reference: IN2895

Is the only difference between the FIFO algorithm and the SSTF algorithm the way the the next block will be selected? Can the rest be left as it is — such as readcomplete()?

Answer 42:

Yes, but in a sense, that is the only difference between all scheduling algorithms: which block is selected next. In FIFO, it's the oldest one (so will always be at the far end of the queue). In SSTF, it's the one closest to the last. But this will need modifications to readcomplete() since it's that method which selects the "next" block for the disk to read. That is effectively ordering as you remove things from the queue, but you could order them as you put them into the queue, which would be in blockread(). One of these has to change in any event! The LIFO code represents a simpler starting point perhaps, since it doesn't need the queue (just a stack, which is a bit simpler to code).

Keywords: assess5-1314


Question 43:

Submission reference: IN2896

Will electronic things such as diodes come up in the exam?

Answer 43:

Not directly, no. However, having an understanding of how a processor works, in terms of functional units, clocks and other signals, needs at least some knowledge about the electrical signals involved (mostly whether they are logically 0 or 1, physically Vss or Vdd).

Keywords: exam , electronics


Question 44:

Submission reference: IN2897

What is high impedance?

Answer 44:

High impedance can be thought of as "high resistance" if it helps. In simple terms, it effectively means that whatever is being talked about is disconnected — i.e. if it were connected directly to Vss or Vdd then little or no current would flow (because of the high resistance). In digital electronics, and elsewhere, high-impedance inputs can be used to "sense" the voltage on a wire (0 or 1) without interfering with it (much at least). Oscilloscope probes are typically high-impedance things (millions of Ohms) allowing one to prod around in a physical circuit to see what the signals are without interfering with them.

Resistance isn't quite impedance though — Wikipedia can tell you more.

Keywords: electronics


Question 45:

Submission reference: IN2898

What is EEPROM used for?

Answer 45:

For the AVR, persistent non-volatile storage (e.g. configuration data for a device).

Keywords: avr


Question 46:

Submission reference: IN2900

Will specific knowledge of the Arduino or assembly programmed be needed for the exam?

Answer 46:

Yes, but more general knowledge about architecture and assembly programming. I'm in the process of preparing some "mock" questions on the new architecture content.

Keywords: exam , avr


Question 47:

Submission reference: IN2899

What is the the PIN register?

Answer 47:

For a particular I/O port on the AVR, this is the register that holds the actual values of signals at the pin. E.g. for an input port, this is where you read whether the wire is high (1 or Vdd) or low (0 or Vss). For an output port it generally reflects the value you're driving onto the pin.

Keywords: avr , hardware


Question 48:

Submission reference: IN2902

For the implementation of the SSTF I have used the Math.abs function is this allowed?

Answer 48:

No — but you can achieve the same in a single expression, e.g.: ((i < 0) ? -i : i). If you really want an abs function, just write one into the DSched class.

Keywords: assess5-1314


Question 49:

Submission reference: IN2905

Are you allowed to use threads in the assignment?

Answer 49:

Nope — that would probably make things behave very strangely! (and altogether much more complex). But moreover, it's not necessary, and extremely unlikely that a real OS would use threads in such a thing (it might be sensible to have one thread per disk queue in a real OS, but as there's only one disk being considered in the assessment, threads wouldn't make sense here).

Keywords: assess5-1314


Question 50:

Submission reference: IN2908

In the assessment for disk scheduling, we're told not to use for-each loops yet one is already coded in? Do we specifically need to remove that and find out a different way of approaching it? Or is it just to be left?

Also, why is the modulo used when incrementing the queue head?

Answer 50:

There is no for-each loop in the existing code! By for-each I mean things that looks like:

    for (Thing i : things) {
        ...
    }

But there's nothing wrong with using a regular for-loop, i.e. things that look like:

    for (start; test; iterate) {
        ...
    }

Keywords: assess5-1314


Question 51:

Submission reference: IN2911

For the assessment how many blocks are there on the disk?

Answer 51:

There are DiskSim.NBLOCKS blocks on the disk.

Keywords: assess5-1314


Question 52:

Submission reference: IN2912

In the assessment how do you access block 10219000 when there are only 8388608 blocks?

Answer 52:

You can't clearly (i.e. it's not there). However what happens here is what would typically happen in a real system: it wraps around (so you end up accessing block (10219000 modulo 8388608), give or take — the real issue is what DiskSim.block_to_track returns, which is bounded). The particular reason this is still here is because I forgot to remove those requests from the test file (or at least truncate them) when the size of the disk got changed at some point. But they shouldn't cause any harm.

Keywords: assess5-1314


Question 53:

Submission reference: IN2904

I was looking at the variable brightness LED assembly code, you first of all have both the brightness and the accumulator value are set to 0, so when this first goes round 255*255 times will the LED ever turn on because it will never overflow?

Answer 53:

Correct — it is completely "off" in this case.

Keywords: avr , assembly


Question 54:

Submission reference: IN2913

Step one to changing the code to SSTF. Could you please explain a little more on how to achieve this? For example, do I need to use the "int DiskSim.block_to_track (int blk)" method to find the track number and so on?

Answer 54:

The algorithm you need to implement is one that finds the block that has the shortest seek-time. As explained in various places (and as should well be common knowledge!) seek time is mostly a function of track-to-track distance. I.e. the further the read/write heads have to travel, the longer the request will take. In code, this amounts to finding the block (and request) with the closest track number to the one that was done just previously (initially zero, see Question 27 (2013)). That involves turning the block number into a track number, which block_to_track does.

Keywords: assess5-1314


Question 55:

Submission reference: IN2906

In the up_counter assembly code example what do these two lines of code do?

    ld  r24, Y+0 
    ld  r25, Y+1 

Answer 55:

These are examples of load indirect with displacement. The first loads the 8-bit word at the 16-bit SRAM address pointed to by Y+0 (i.e. Y) into register r24; the second similarly for the 16-bit SRAM address pointed to by Y+1 (i.e. the next byte) into register r25. The range of displacements and what can be used as the base 16-bit address (e.g. "Y") are limited, but enough to be useful (in cases like this).

Keywords: avr , assembly


Question 56:

Submission reference: IN2914

In assignment 5 there is this code:

    private class ReadReq
    {
        int blk;         /* block number */
        BRequest req;    /* request info */
    }

Do we need to keep the BRequest or can we remove it?

Answer 56:

Given that you need to pass it to DiskSim.disk_readblock to perform an actual read, you need to keep it! There's nothing to stop you keeping this somewhere else though; the ReadReq class here is just convenience (I would have used a struct in C, tuple in Erlang, etc. but this is Java).

Keywords: assess5-1314

Referrers: Question 63 (2013)


Question 57:

Submission reference: IN2919

Can you please explain how the following error occurs:

highlevel_didread(): read queue x got unexpected block XYZ

I tried looking in the "requests" text file to ensure my sorting algorithm wasn't manipulating any blocks. But I can clearly see that XYZ appears in the file.

Answer 57:

See the answers to Question 30 (2013) and Question 23 (2013) — probably the same cause.

Keywords: assess5-1314

Referrers: Question 66 (2013)


Question 58:

Submission reference: IN2922

For the submission does our implementation have to be FIFO? OR is the objective to achieve the most efficient method using LIFO OR FIFO?

Answer 58:

Both FIFO and LIFO are poor implementations, and what I've given you already — submitting either would clearly get you zero..! A working SSTF solution is the minimum standard, and will probably score in the range 40%-60%. There are better algorithms than SSTF for disk scheduling — speaking generally, rather than for specific workload types — and these will score higher (e.g. C-SCAN, elevator, hybrid). The best student submission(s) will score 100% and others will be scaled based on performance as appropriate (how it happens in practice will depend on the submissions plus common sense).

Keywords: assess5-1314


Question 59:

Submission reference: IN2925

For the mock paper that was put up I was looking at the first part of question 2, am I right in thinking that the initial value 0x0200 is a relative jump forward 512? If so how would you work out the next instruction after 0x0FF0? Just add 1 bit?

Answer 59:

Not quite — 0x0200 is the address where the instruction resides (i.e. the current program counter value). The instruction itself is 0x0FF0: i.e. this is the value that appeared on the dashed line in the diagram, part of which goes to the "sign-extend" unit, the comparator and anything else (not shown). From knowing what the instruction is, you need to figure out what happens with each of the internal components, and as a result, what the new program counter value will be. The question in this case asks you to "describe the sequence of actions", so you should be specific about what happens and when (part of the when is given in the question by the analyzer trace, which tells you how the internal components are orchestrated).

Keywords: architecture , exam


Question 60:

Submission reference: IN2926

How do you control the USART with polling?

Answer 60:

See lecture 9 and echo38k.asm on Moodle/raptor.

Keywords: avr , usart

Valid CSS!

Valid XHTML 1.0!

Maintained by Fred Barnes, last modified Wed May 25 15:07:20 2016