[buffer] Question sur l'algorithme breada
Bonjour,
J'ai une petite question sur l'algorithme breada (bloc read and read ahead) permettant une lecture sur buffer de deux bloc d'un file system.
voici l'algorithme:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
if(first block not in cache)
{
get buffer for first block
if(buffer data not valid)
initiate disk read
}
if(first second block not in cache)
{
get buffer for second block
if(buffer data not valid)
initiate disk read
else
release buffer
}
if(first block was originally in cache)
{
read first block (bread)
return buffer
}
sleep(event first buffer contains valid data)
return buffer |
Qu'est-ce que cela signifit lorsque l'algorithme dit:
Code:
1 2 3 4 5
| if(first block was originally in cache)
{
read first block (bread)
return buffer
} |
pourquoi faire ceci puisqu'au debut de l'algorithme, on fait deja ceci:
Code:
1 2 3 4 5 6
| if(first block not in cache)
{
get buffer for first block
if(buffer data not valid)
initiate disk read
} |
Merci.