Sunteți pe pagina 1din 3

Domaa zadaa 2

1. Nae raunalo upravlja memorijom pomou izmjenjivanja (swapping). Praznine u memoriji su, poredano uzlazno po adresi, veliine 10KB, 4KB, 20KB, 18KB, 7KB, 9KB, 12KB i 15KB. Koja praznina je zauzeta prilikom sljedeih zahtjeva koji dolaze jedan za drugim: 1. 12KB 2. 10KB 3. 9KB Odgovori za svaki od algoritama izmjenjivanja: FirstFit, NextFit, BestFit, WorstFit, QuickFit.
Consider a swapping system in which memory consists of the following hole sizes in memory order: 20K, 10K, 18K, 9K, 12K, and 15K. Which hole is taken for successive segment requests of: (a) 6 K (b) 10K (c) 12K (d) 9K for first fit? Now repeat the question for best fit, worst fit, and next fit. (8 points) Ans: First fit: (a) 20K (b) remainder of 20K (c) 18K (d) 10K Best fit: (a) 9K (b) 10K (c) 12K (d) 15K Worst fit: (a) 20K (b) 18K (c) 15K (d) remainder of 20K Next fit: (a) 20 K (b) remainder of 20K (c) 18K (d) 9K

2. Koja je razlika izmeu fizike i virtualne adrese? Real memory uses Physical addresses.These are the members that the memory chips react to on the bus. Virtual addresses are the logical addresses that nrefer to a process' address space. Thus, a machine with a 16-bit word can generate virtual addresses upto 64K, regardless of whether the machine has more or less memory than 64 KB Are you talking about memory addresses and virtual memory? In that case. The physical memory is the primary memory (RAM). A physical address is the address to a physical memory location in the primary memory. The secondary memory is normally a disk, like a swap partition or a swap file, and (normally) much slower than the primary memory. The virtual memory is the physical memory combined with the secondary memory. A virtual address is the address of something stored in the virtual memory. The data stored at a virtual address might be located in the primary or in the secondary memory.

A programmer uses the virtual address when addressing data. To the programmer it appears as if there is a large amount of fast physical memory available and he/she never has to worry about that the program might need more physical memory than available. The instructions being executed and the data that is read/written must be in the primary memory. The programmer don't have to worry about this either, the system takes care of that. If the page containing the requested virtual address is not in the primary memory, the operating system finds some free physical memory (or selects a page to swap out to secondary memory) and loads the requested page to the primary memory. Logical address generated by the CPU; also referred to as virtual address. Physical address address seen by the memory unit. ->Logical and physical addresses are the same in compile-time and load-time address-binding schemes; logical (virtual) and physical addresses differ in execution-time address-binding scheme 3. Za svaku od sljedeih decimalnih virtualnih adresa izraunaj broj stranice i offset za sluaj stranice od 4KB i 8KB: 20000, 32768, 60000. For each of the following decimal virtual addresses, compute the virtual page number and offset for a 4 KB page and for and 8 KB page: 20000, 32768, 60000. 4 KB = 2^12 B 8 KB = 2^ 13 B Address Page Number Offset (4KB) Page Number Offset (8KB) (4KB) (8KB) 20000 4 3616 2 3616 32768 8 0 4 0 60000 14 2656 7 2656 4. Raunalo ima 32-bitne virtualne adrese i stranice veliine 4KB. Program i podaci zajedno stanu u prvu, najniu, stranicu (0 do 4095). Stog je smjeten u najviu stranicu. Koliko unosa je potrebno u tablici stranica ako se koristi tradicionalno stranienje (jednorazinska tablica)? Koliko unosa u tablici stranica je potrebno ako se koristi dvorazinsko stranienje s 10 bita po razini (tablici)? ANSWER: Twenty bits are used for the virtual page numbers, leaving 12 over for the offset. This yields a 4-KB page. Twenty bits for the virtual page implies 2^20 pages 5. Raunalo ima 4 okvira stranica. Vrijeme uitavanja (Loaded), vrijeme posljednjeg pristupa (Last ref.), te R i M bitovi su prikazani u tablici (vremena su u otkucajima sata): S 0 Loaded 126 Last ref. 280 R 1 M 0

1 2 3

230 140 110

265 270 285

0 0 1

1 0 1

1. Koju stranicu e NRU zamijeniti? 2. Koju stranicu e FIFO zamijeniti? 3. Koju stranicu e LRU zamijeniti? 4. Koju stranicu e zamijeniti algoritam drugog pokuaja (second chance)? 6. Ako je stranica dijeljena meu dva procesa, jeli mogue da je stranica read-only za jedan proces, a read-write za drugi? Zato? If a page is shared between two processes, is it possible that the page is read-only for one process and read-write for the other? 7. Mnoge verzije UNIXa koriste unsigned 32-bitnu cjelobrojnu varijablu za brojanje sekundi od "nultog" vremena. Koliko dugo e ta varijabla biti dovoljna prije nego se vrati na poetnu vrijednost? Does anyone know the exact date of the end of the UNIX Epoch if a 32 bit unsigned int is used to keep track of the seconds since January 1st 1970? I understand that a 32 bit unsigned int can hold 4,294,967,295 seconds. And since there are 3600 seconds in an hour and 86,400 seconds in a day, and 365.25 days in a year, then I get that the epoch will end in 49,710.2696 days which is roughly 136.099 years. But does anyone have the exact date. I want to make sure my calculations are right. Most of the stuff I found on the web concerned a 32 bit signed integer and as such that would end in 2038. Any help would be appreciated. 22:14:07 on January 18, 2038 The number of seconds in a mean year is 365.25 24 3600. This number is 31,557,600. The counter wraps around after 232 seconds from 1 January 1970. The value of 232/31,557,600 is 136.1 years, so wrapping will happen at 2106.1, which is early February 2106. Of course, by then, all computers will be at least 64 bits, so it will not happen at all. 8. U kojem od 4 U/I programska sloja se obavlja: 1. Raunanje sektora i glave za itanje s diska. 2. Pisanje naredbi u registre ureaja. 3. Provjeravanje je li korisniku doputeno koristiti ureaj. 4. Konvertiranje binarnih integera u ASCII za tiskanje. 1.Device driver 2. device driver 3.device-independent software 4. user-level software

S-ar putea să vă placă și