3. Virtual memory
The virtual memory is the separation between logical and
physical memory.
In order to avoid external fragmentation, we can divide the
information into smaller pieces called page frames, which
contain the data of that page.
4. When there is not enough space to run a process, we can
compact or relocate it. We can also swap to the disk a
process that is not being used. Then, when it becomes
available we can restore the process.
When we are looking for a process that is located in disk,
a page fault occur.
5. Problems
FIFO The worst result (higher rate Belady Anomaly
of page faults)
Optimization the best result (lower rate of not implementable
page faults)
LRU too much information plus hardware.
Las ultimas paginas introducidas
recientemente, estan continuamente
reemplazandose.
MFU Las paginas mas populares se reemplazan
6. Pseudocode
struct
array //data or elements initialized if b = null
b address new data
a = null //count else
create b set pointer next address
a++
if array not avaible
return true if b = null
else return false
return false move data add pointer
of d to data.
if b = full
return false
new space
move data to space
pointer new element/data
7. TLB
A translation lookaside buffer (TLB) is a cache memory
administrated by the MMU. It contains slots of the page table, it
also maps the relationship between virtual and physical
adresses.
The page table keeps the track of where the virtual pages are
loaded into the physical memory.
8. Pseudocode if tlb = page faul
goto to page table
TLB update()
read swap
initializing user prog move data to memory
initializing swapfile
if page table valid bit = true
if user prog = null write swap
return false
else
swap = *user prog find next tlb
if tlb dirty bits/data = true
initializing page table page table dirty entry
up
pointer to address
10. File systems
A file is a collection of information that is stored in the
secondary storage. Files can be programs , data, secuence
bits, bytes, lines, etc.
Files can store different information like programs, object
programs, executable programs, numerical data, text, registers,
images, sounds, etc.
File attributes:
● Name
● Type
● Location
● Size
● Protection
● Time, date and user identification
11. File operations
● Create a file
● Write a file
● Read a file
● Relocate inside a file
● Delete a file
● Cut a file
12. Access Methods
There are several ways that allow programs to access files.
Sequential access.
Open the file, read or write on it from beginning to end. Process an order, one
register after another
13. Direct access
Direct access specify the starting adress of the information. Allows
random access to any block of the file, it is a numbered sequence of
blocks and registers.
A direct access file allows to read or write arbitriary blocks, there are
no restrictions about the order or reading and writing.
Other method
Indexed access. Classify files by identifier (for example name),
then recover the record associated with name.
14. File systems
File systems structure stored information in a storage unit,
which is represented by a file manager in the form of text or a
graph
Storage devices are used to allow data access like a chain of
blocks of the same size, this blocks consist of data users add in
their files. This blocks are also called sectors, their usual size is
512 bytes.
15.
16. Without a file system programs cannot be able to access data
by file name or directory and we would need to be able to
directly access data regions on a storage device.
File systems are used on data storage devices such as
magnetic storage disks or optical discs to maintain the physical
location of the computer files.
17. Directory operations
● Search a file
● Create a file
● Eliminate a file
● List a directory
● Change name of a file
● Travel filesystem
File protection is important and necessary because people
want to share files but not all aspects of all files. Unix have
three operations for files: read, write and execute. Files have an
owner and a group. For each of this operation there are
protections on basis of everybody, group and owner.
18. Pseudocode
Hash table
registro par { llave, valor } function asignar(llave, valor) {
var vector de pares casilla[0..numcasillas-1]
i := buscacasilla(llave)
function buscacasilla(llave) { if casilla[i] está ocupada
i := hash(llave) módulo de numcasillas
loop { casilla[i].valor := valor
if casilla[i] esta libre or casilla[i].llave =
llave
else {
return i if tabla casi llena {
i := (i + 1) módulo de numcasillas
} hacer tabla más grande
}
(nota 1)
function busqueda(llave) i := buscacasilla(llave)
i := buscacasilla(llave)
if casilla[i] está ocupada // llave está en }
la tabla
return casilla[i].valor
casilla[i].llave := llave
else // llave no está en la casilla[i].valor := valor
tabla
return no encontrada }
}