190 likes | 623 Views
វិទ្យាស្ថានជាតិពហុបច្ចេកទេសកម្ពុជា មហាវិទ្យាល័យ វិទ្យាសាស្រ្តកុំព្យូរទ័រ មុខវិជ្ជា Operating System កិច្ចការស្រាវជ្រាវអំពី : 1.File Concept 2.Access Methods សមាជិកស្រាវជ្រាវមាន : 1 កាន់ ចាន់រាសី បុត្រ 2 កែវ ហ៊ុយ ម៉េង 3 អុល គឹមអេង 4 នី មិ នា 5 កាយ ប៊ុន ហេង. File Concept.
E N D
វិទ្យាស្ថានជាតិពហុបច្ចេកទេសកម្ពុជាវិទ្យាស្ថានជាតិពហុបច្ចេកទេសកម្ពុជា មហាវិទ្យាល័យ វិទ្យាសាស្រ្តកុំព្យូរទ័រ មុខវិជ្ជា Operating System កិច្ចការស្រាវជ្រាវអំពី: 1.File Concept 2.Access Methods សមាជិកស្រាវជ្រាវមាន: 1កាន់ ចាន់រាសីបុត្រ 2កែវ ហ៊ុយ ម៉េង 3 អុល គឹមអេង 4នី មិនា 5 កាយ ប៊ុន ហេង
File Concept • មានពីរប្រភេទគឺ: • Data • numeric • character • binary • Program
រចនាសំម្ព័ន្ធFile • រចនាសំម្ព័ន្ធស្រួលមាន: • Lines • Fixed length • Variable length • រចនាសំម្ព័ន្ធស្មុកស្មាញមាន: • Formatted document • Relocatable load file • វាអាចធ្វើឲ្យដូចគ្នាដោយវិធីមួយដោយការបញ្ជូលតាមលក្ខណ:ខាងក្រោម; • នណាជាអ្នកធ្វើ: • Operating system • Program
File Attributes • Name:អាចឲ្យគេអានបាន • Identifier : មាន tag តែមួយរឺ(number)ដើម្បីសំគាល់file មួយនៅក្នុងfile system. • Type :តំរូវការសំរាប់ system ដែលអាច support ប្រភេទផ្សេងៗ. • Location :ចង្អុលទៅកាន់ទីតាំងfileនៅលើdevice.
Size– current file size • Protection :គ្រប់គ្រង់ទៅលើអ្វីដែលអាច Reading , Writing ,Executing. • Time, date, and user identification :data សំរាប់ការការពារ,សុវត្តិភាព ហើយនឹងការប្រីនៅលើ monitoring • រាល់ពត័មានអំពីfile ត្រូវបានរក្សាទុកនៅក្នុង directory Structure,ដែលបានរក្សាទុកក្នុងDisk.
File Operations • File គឺជាការសង្ខេបនៃប្រភេទDataមួយ • Create • Write • Read • Reposition within file • Delete • Truncate • Open(Fi) – search the directory structure on disk for entry Fi, and move the content of entry to memory • Close (Fi) – move the content of entry Fi in memory to directory structure on disk
Open Files • ផែ្នកនៃDataខ្លះៗគឺត្រូវការដើម្បីរៀបចំក្នុងការOpen file: • File pointer: គឺចង្អុលទៅកាន់ទីតាំង read/write ចុងក្រោយ, ហើយមួយ process មានfile open. • File-open count: ការរាប់ចំនួនលេខនៅពេលfileមួយបើកដើម្បីអនុញ្ញាតឲ្យយកចេញ dataពីតារាង Open file ពេលដែលProcesses ចុងក្រោយត្រូវបានបិទវា។ • Disk location of the file:លាក់ទុកdataហើយaccessពត័មាន • Access rights:មួយprocessអាចaccessពត័មានមួយរបៀប
Open File Locking • វាបានផ្តល់ឲ្យតាម operating systems and file systems • Mediates access to a file • Mandatory or advisory: • Mandatoryគឺaccessបានបដិសេធ មិនពឹងលើ locks heldហើយការស្នើរសុំ • Advisory :processes អាចស្វែងរកstatus of locks ហើយសំរេចអ្វីដែលត្រូវធ្វើ។
File Locking Example – Java API import java.io.*; import java.nio.channels.*; public class LockingExample{ public static final boolean EXCLUSIVE = false; public static final boolean SHARED = true; public static void main(String arsg[]) throws IOException{ FileLocksharedLock = null; FileLockexclusiveLock = null; try { RandomAccessFileraf = new RandomAccessFile("file.txt", "rw"); // get the channel for the file FileChannelch = raf.getChannel(); // this locks the first half of the file - exclusive exclusiveLock = ch.lock(0, raf.length()/2, EXCLUSIVE); /** Now modify the data . . . */ // release the lock exclusiveLock.release();
File Locking Example – Java API (cont) // this locks the second half of the file - shared sharedLock = ch.lock(raf.length()/2+1, raf.length(), SHARED); /** Now read the data . . . */ // release the lock exclusiveLock.release(); }catch (java.io.IOExceptionioe) { System.err.println(ioe); }finally { if (exclusiveLock != null) exclusiveLock.release(); if (sharedLock != null) sharedLock.release(); } } }
Access Methods • Sequential Access read next write next reset no read after last write (rewrite) • Direct Access read n write n position to n read next write next rewrite n n = relative block number
សូមអរគុណចំពោះការយកចិត្តទុកដាក់!សូមអរគុណចំពោះការយកចិត្តទុកដាក់!