Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java programming Please in original work or else report: Instruction: What I'd like is some sort of database of recipes to which I can send

Java programming Please in original work or else report: Instruction: What I'd like is some sort of database of recipes to which I can send queries such as "Find me something that doesn't contain cabbage or tomatoes that takes less than 3011 minutes to prepare", or "I've got kohlrabi in the veg box AGAIN, are there any recipes I haven't tried that might make something edible out of it?", or "I've actually got a couple of hours free to cook this weekend, what was that complicated Ottolenghi recipe I flagged two weeks ago to try later?". The database needs to cope with the fact that ingredients can have different names but mean the same thing: e.g. "sugar" and "plain flour", and that "1/4 lb" and "4oz" are the same thing and equal to "1010g" (and not 113g). It would be great if once I've chosen this week's menu, it could produce a shopping list I can plug into www.myfavouritesupermarket.com, and it needs to be usable by non-engineers.\\Suppose a read takes 3 units of time and the processing 2 units of time, so that reading a block and processing takes 5 units of elapsed time. Assuming the machine is otherwise idle, how can this elasped time be reduced? State any assumptions about hardware features you are making. [5 marks] (c) Describe how polled I/O works and state its disadvantages. Under what conditions is polling a sensible approach? Describe an alternative approach. (You may find it helpful to provide a few lines of psuedo code.) [4 marks] (d) What advantages does direct memory access (DMA) provide? Describe its operation as seen by a device driver in the operating system. (You may find it helpful to a few lines of psuedo code.) [5 marks] 6 SECTION B 112 Operating Systems One goal of a multiuser operating system is to protect each user's information and activity from damage caused by accidental or deliberate actions of other users of the system. (a) Describe a mechanism that operating systems use to reduce the opportunity for a user process to prevent another user's process from making progress. In your description include any particular hardware features that are relied upon. (b) Describe two alternative mechanisms that operating systems could use to reduce the opportunity for a user process to access or corrupt the information being used by another user's process. In your descriptions include any particular hardware features that are relied upon. [6 marks] (c) Describe how an operating system might attempt to ensure that long-term user information (that is, information which exists beyond process execution) is not interfered with or misused by other users. Your description should be clear about when actions are performed and the resources they consume. [5 marks] (d) To what extent are the mechanisms described above useful in single user systems? [3 marks] (e) How do operating systems ensure that they are not themselves overly-restricted by these mechanisms? [3 marks] 4 In the context of multithreaded algorithms, define work and span, and state the work law and the span law. [3 marks] (b) Prove that the performance of a greedy scheduler is optimal to within a factor of 2. (Proving all intermediate theorems is not required if you state them correctly.) [4 marks] (c) Version A of a multithreaded algorithm takes 500 seconds on a uniprocessor machine and 50 seconds on a 32-processor machine. Version B takes the same time as A on a single processor but only 24 seconds on the 32-processor machine. (i) Define the parallelism of a computation and compute the parallelism of algorithms A and B. Which of the two has higher parallelism, and by how much? (Hint: use one of the greedy scheduler theorems to derive an approximation for one of the unknowns.) [6 marks] (ii) Estimate the running times of algorithms A and B on a 4-processor and on a 1024-processor machine, explaining how you obtain them. [3 marks] (iii) Sketch possible computation DAGs for algorithms A and B and use them to discuss the results obtained. As the number of processors in the host machine varies, is A or B faster? [4 marks] 2 CST.2014.3.3 2 Algorithms II (a) Consider van Emde Boas (v1EB) trees. (i) On its own page for legibility, draw the smallest vEB tree storing keys 0, 3, 6, 7. The correctness of the structure and the accuracy of all fields of all nodes are important. Once done, write each of the keys under the cluster in which it is logically stored. [8 marks] (ii) vEB trees store the minimum and maximum key of a subtree in the root node, but do not store the minimum key in any of the descendent clusters. Explain all the reasons why this provides a performance advantage compared with proto-vEB trees. [4 marks] (b) Consider proto-vEB trees. The following pseudocode attempts to implement a method to delete a key from a proto-vEB node. Give a clear explanation of the strategy that it uses. 7 Discrete Mathematics (a) Let m be a fixed positive integer. (i) For an integer c, let Kc = { k N | k c (mod m) }. Show that, for all c Z, the set Kc is non-empty. [2 marks] (ii) For an integer c, let c be the least element of Kc. Prove that for all a, b Z, a b (mod m) iff a = b. [4 marks] (b) (i) State Fermat's Little Theorem. [2 marks] (ii) Prove that for all natural numbers m and n, and for all prime numbers p, if m n CST.2014.2.7 6 Software and Interface Design The following is an extract from a design brief written by the client for one of the 2014 Cambridge group design projects. (a) For each of the following software project phases, suggest a design model or representation that would be a helpful aid in the design process. For each of these, sketch an example to show what this model looks like, based on some part of the above design brief. (i) Inception phase (ii) Elaboration phase (iii) Construction phase (iv) Transition phase mod (p 1) (a) Show how two NOR gates may be connected to form an RS latch. Describe its operation and give a table relating its inputs to its outputs. How could you use this circuit to eliminate the effect of contact bounce in a single pole double throw switch supplying an input to a digital logic circuit? [6 marks] (b) The state sequence for a particular 4-bit binary up-counter is as follows: Thanks

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Operations Management Managing Global Supply Chains

Authors: Ray R. Venkataraman, Jeffrey K. Pinto

1st edition

1506302935, 1506302939, 978-1506302935

More Books

Students also viewed these Programming questions