Fs Chapter3

Embed Size (px)

Citation preview

  • 7/31/2019 Fs Chapter3

    1/74

  • 7/31/2019 Fs Chapter3

    2/74

    File Processing (3) Konkuk University (DB Lab.) 2

  • 7/31/2019 Fs Chapter3

    3/74

    File Processing (3) Konkuk University (DB Lab.) 3

  • 7/31/2019 Fs Chapter3

    4/74

    File Processing (3) Konkuk University (DB Lab.) 4

  • 7/31/2019 Fs Chapter3

    5/74

    File Processing (3) Konkuk University (DB Lab.) 5

  • 7/31/2019 Fs Chapter3

    6/74

    File Processing (3) Konkuk University (DB Lab.) 6

    BoomRead/write heads

    Spindle

    Platters

  • 7/31/2019 Fs Chapter3

    7/74

    File Processing (3) Konkuk University (DB Lab.) 7

  • 7/31/2019 Fs Chapter3

    8/74

    File Processing (3) Konkuk University (DB Lab.) 8

  • 7/31/2019 Fs Chapter3

    9/74

    File Processing (3) Konkuk University (DB Lab.) 9

  • 7/31/2019 Fs Chapter3

    10/74

    File Processing (3) Konkuk University (DB Lab.) 10

  • 7/31/2019 Fs Chapter3

    11/74

    File Processing (3) Konkuk University (DB Lab.) 11

  • 7/31/2019 Fs Chapter3

    12/74

    File Processing (3) Konkuk University (DB Lab.) 12

  • 7/31/2019 Fs Chapter3

    13/74

    File Processing (3) Konkuk University (DB Lab.) 13

  • 7/31/2019 Fs Chapter3

    14/74

  • 7/31/2019 Fs Chapter3

    15/74

  • 7/31/2019 Fs Chapter3

    16/74

    File Processing (3) Konkuk University (DB Lab.) 16

    Clusternumber Clusterlocation

    12

    3...

    The part of the FAT

    pertaining to our file

    .

    .

    .

    2

    1

    3

  • 7/31/2019 Fs Chapter3

    17/74

    File Processing (3) Konkuk University (DB Lab.) 17

    file extentsextent

    extent

    extent

  • 7/31/2019 Fs Chapter3

    18/74

    File Processing (3) Konkuk University (DB Lab.) 18

  • 7/31/2019 Fs Chapter3

    19/74

    File Processing (3) Konkuk University (DB Lab.) 19

  • 7/31/2019 Fs Chapter3

    20/74

    File Processing (3) Konkuk University (DB Lab.) 20

  • 7/31/2019 Fs Chapter3

    21/74

    File Processing (3) Konkuk University (DB Lab.) 21

    1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 3 3 3 4 4 4 4 5 5 5

    1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 3 3 3 4 4 4 4 5 5 5

    Sector 1 Sector 2 Sector 3 Sector 4 Sector 5

    (a) Sector organization

    (b) Block organization (more desirable)

  • 7/31/2019 Fs Chapter3

    22/74

    File Processing (3) Konkuk University (DB Lab.) 22

    Countsubblock

    Datasubblock

    Countsubblock

    Datasubblock

    Countsubblock

    Keysubblock

    Datasubblock

    Countsubblock

    Keysubblock

    Datasubblock

  • 7/31/2019 Fs Chapter3

    23/74

  • 7/31/2019 Fs Chapter3

    24/74

    File Processing (3) Konkuk University (DB Lab.) 24

  • 7/31/2019 Fs Chapter3

    25/74

  • 7/31/2019 Fs Chapter3

    26/74

    File Processing (3) Konkuk University (DB Lab.) 26

  • 7/31/2019 Fs Chapter3

    27/74

  • 7/31/2019 Fs Chapter3

    28/74

    File Processing (3) Konkuk University (DB Lab.) 28

  • 7/31/2019 Fs Chapter3

    29/74

    File Processing (3) Konkuk University (DB Lab.) 29

  • 7/31/2019 Fs Chapter3

    30/74

  • 7/31/2019 Fs Chapter3

    31/74

    File Processing (3) Konkuk University (DB Lab.) 31

  • 7/31/2019 Fs Chapter3

    32/74

    File Processing (3) Konkuk University (DB Lab.) 32

  • 7/31/2019 Fs Chapter3

    33/74

  • 7/31/2019 Fs Chapter3

    34/74

    File Processing (3) Konkuk University (DB Lab.) 34

  • 7/31/2019 Fs Chapter3

    35/74

  • 7/31/2019 Fs Chapter3

    36/74

    File Processing (3) Konkuk University (DB Lab.) 36

  • 7/31/2019 Fs Chapter3

    37/74

    File Processing (3) Konkuk University (DB Lab.) 37

  • 7/31/2019 Fs Chapter3

    38/74

    File Processing (3) Konkuk University (DB Lab.) 38

    How the byte is stored on a

    disk, when a program writea byte to a file on a disk ?

  • 7/31/2019 Fs Chapter3

    39/74

    File Processing (3) Konkuk University (DB Lab.) 39

  • 7/31/2019 Fs Chapter3

    40/74

    File Processing (3) Konkuk University (DB Lab.) 40

    1

    2

    3

    4

    5

    Logical layerLogical layer

  • 7/31/2019 Fs Chapter3

    41/74

    File Processing (3) Konkuk University (DB Lab.) 41

    6

    7

    8

    9

    Physical layerPhysical layer

  • 7/31/2019 Fs Chapter3

    42/74

    File Processing (3) Konkuk University (DB Lab.) 42

  • 7/31/2019 Fs Chapter3

    43/74

    File Processing (3) Konkuk University (DB Lab.) 43

  • 7/31/2019 Fs Chapter3

    44/74

    File Processing (3) Konkuk University (DB Lab.) 44

  • 7/31/2019 Fs Chapter3

    45/74

    File Processing (3) Konkuk University (DB Lab.) 45

  • 7/31/2019 Fs Chapter3

    46/74

    File Processing (3) Konkuk University (DB Lab.) 46

  • 7/31/2019 Fs Chapter3

    47/74

    File Processing (3) Konkuk University (DB Lab.) 47

    FIGURE 3.21 The file manager sends the I/O processor instructions in the from of an I/O

    Processor program. The I/O processor gets the data from the system buffer, prepares it on

    the disk, then sends it to the disk controller, deposits it on the surface of the disk.

    Users program

    ......

    Users data area:

    File Manager

    .

    Invoke I/O processor

    .

    .

    .

    I/O processor

    Program.

    .c: P

    p

    System

    buffer

    p

    p

    p

    Disk

    controller

    I/O processor

  • 7/31/2019 Fs Chapter3

    48/74

    File Processing (3) Konkuk University (DB Lab.) 48

  • 7/31/2019 Fs Chapter3

    49/74

    File Processing (3) Konkuk University (DB Lab.) 49

  • 7/31/2019 Fs Chapter3

    50/74

    File Processing (3) Konkuk University (DB Lab.) 50

  • 7/31/2019 Fs Chapter3

    51/74

    File Processing (3) Konkuk University (DB Lab.) 51

  • 7/31/2019 Fs Chapter3

    52/74

    File Processing (3) Konkuk University (DB Lab.) 52

    Program data area

    Program data area

    To disk

    To diskI/O buffer 1

    I/O buffer 2

    I/O buffer 1

    I/O buffer 2

  • 7/31/2019 Fs Chapter3

    53/74

    File Processing (3) Konkuk University (DB Lab.) 53

  • 7/31/2019 Fs Chapter3

    54/74

    File Processing (3) Konkuk University (DB Lab.) 54

    systembuffer

    programsdata area

    systembuffer

    Disk

    Diskusers

    program location(pointer)

    Movemode

    Locatemode

  • 7/31/2019 Fs Chapter3

    55/74

    File Processing (3) Konkuk University (DB Lab.) 55

  • 7/31/2019 Fs Chapter3

    56/74

    File Processing (3) Konkuk University (DB Lab.) 56

    Disk

    Disk

    Scatterinput

    Gatheroutput

    readv()

    writev()

    buffer 1

    buffer 2

    buffer 1

    buffer 3

    buffer 2

  • 7/31/2019 Fs Chapter3

    57/74

    File Processing (3) Konkuk University (DB Lab.) 57

  • 7/31/2019 Fs Chapter3

    58/74

    File Processing (3) Konkuk University (DB Lab.) 58

    I/O system

    PROCESSES

    KERNEL

    User programs Libraries Shell commands

    System callinterface

    Block I/Osystem(normalfiles)

    CharacterI/O system(terminals,printers, etc.)

    NetworkI/O system(sockets)

    block device drivers

    disk disk...

    character device drivers

    consoles printers...

    network interface drivers

    ...networks...

    HARDWARE

  • 7/31/2019 Fs Chapter3

    59/74

    File Processing (3) Konkuk University (DB Lab.) 59

  • 7/31/2019 Fs Chapter3

    60/74

    File Processing (3) Konkuk University (DB Lab.) 60

  • 7/31/2019 Fs Chapter3

    61/74

    File Processing (3) Konkuk University (DB Lab.) 61

    File

    descriptor

    File table

    entry

    0 (keyboard)1 (screen)

    2 (error)3 (normal)4 (normal)5 (normal)

    .

    .

    .

    to open filetable

  • 7/31/2019 Fs Chapter3

    62/74

    File Processing (3) Konkuk University (DB Lab.) 62

  • 7/31/2019 Fs Chapter3

    63/74

    File Processing (3) Konkuk University (DB Lab.) 63

    R/Wmode

    # of

    processesusing it

    Offset

    of nextaccess

    ptr to

    writeroutine

    inode

    tableentry......

    write 1 100 ......

    to inodetable

    write()routinefor this typeof file

  • 7/31/2019 Fs Chapter3

    64/74

    File Processing (3) Konkuk University (DB Lab.) 64

  • 7/31/2019 Fs Chapter3

    65/74

    File Processing (3) Konkuk University (DB Lab.) 65

  • 7/31/2019 Fs Chapter3

    66/74

    File Processing (3) Konkuk University (DB Lab.) 66

  • 7/31/2019 Fs Chapter3

    67/74

    File Processing (3) Konkuk University (DB Lab.) 67

    devicepermissions

    owners useridfile size

    block count

    fileallocationtable

    .

    .

    .

    .

    .

    .

  • 7/31/2019 Fs Chapter3

    68/74

    File Processing (3) Konkuk University (DB Lab.) 68

  • 7/31/2019 Fs Chapter3

    69/74

    File Processing (3) Konkuk University (DB Lab.) 69

  • 7/31/2019 Fs Chapter3

    70/74

    File Processing (3) Konkuk University (DB Lab.) 70

  • 7/31/2019 Fs Chapter3

    71/74

    File Processing (3) Konkuk University (DB Lab.) 71

  • 7/31/2019 Fs Chapter3

    72/74

    File Processing (3) Konkuk University (DB Lab.) 72

  • 7/31/2019 Fs Chapter3

    73/74

    File Processing (3) Konkuk University (DB Lab.) 73

  • 7/31/2019 Fs Chapter3

    74/74

    File Processing (3) Konkuk University (DB Lab.) 74