Full Transcript

File Management System Thursday, September 5, 2024 11:57 PM 1. What happens to the information (your notes) inside the computer? 2. What role does the file system play? 3. How does secondary storage ensure you can access your notes later? 4. Use the terms "bits", "bytes", "file", "secon...

File Management System Thursday, September 5, 2024 11:57 PM 1. What happens to the information (your notes) inside the computer? 2. What role does the file system play? 3. How does secondary storage ensure you can access your notes later? 4. Use the terms "bits", "bytes", "file", "secondary storage", and "file extension" in your explanation Source file: A blueprint or set of instructions for the computer. Object file. A object file is the sequence of bytes organized into block that can be understood by the linker. Attributes of File File Name: myfile.txt File ID: 1234567890 Type: Text Document Location: C:\Users\YourUsername\Documents Size: 1.2 KB Protection/Access Rights: ○ Read: User, Group, Everyone ○ Write: User, Group ○ Execute: None Time, Date, and User ID: 2022-03-15 12:34, YourUsername Explanation of Protection/Access Rights In Windows, permissions are typically granted to security principals (users or groups). The example above shows that the file can be: Read by the User, Group, and Everyone. Write by the User and Group. Execute by None. This means that: The User can read, write, and execute the file. Members of the Group can read and write the file. Everyone else can only read the file. OTHER EXAMPLES : Windows Example: File Name: Project.txt File ID: 1234567890 (This is a placeholder, as Windows doesn't have a direct equivalent to inode number) Type: Text Document Location: C:\Users\YourUsername\Documents Size: 10 KB Protection/Access Rights: Read: User, Group, Everyone Write: User, Group Execute: None FMS Page 1 Execute: None Time, Date, and User ID: 2024-09-05 23:53, YourUsername EXPLANATION : File Name: Project.txt Purpose: This is how you identify and reference the file within your system. File ID: 1234567890 (This is just a placeholder in your example) Purpose: In Windows, a file ID is a unique identifier that helps the operating system find and track the file. It's not directly visible like the file name, but it's used internally. Think of it like a "serial number" for the file. Type: Text Document Purpose: This tells Windows what kind of file it is. This helps Windows open the file in the correct program and understand its content. Location: C:\Users\YourUsername\Documents Purpose: This shows the file's location within the hierarchical folder structure of your Windows system. It helps you find the file and organize it with other files. Size: 10 KB Purpose: This tells you how much storage space the file takes up on your computer. Protection/Access Rights: Read: User, Group, Everyone: ○ Purpose: This means that the file can be read by: ▪ User: The person who owns the file. ▪ Group: Any users who belong to the same group as the owner. ▪ Everyone: All other users on the computer. Write: User, Group: ○ Purpose: This means that only the file owner and members of the owner's group can edit or modify the contents of the file. Execute: None: ○ Purpose: This means that the file is not designed to be executed as a program. Time, Date, and User ID: 2024-09-05 23:53, YourUsername Purpose: This shows the last time the file was modified, along with the user who made that change. This can be useful for tracking updates and determining who might have altered the file. Unix Example: File Name: Project.txt Inode Number: 1234567890 Type: Regular File Location: /home/yourusername/documents Size: 10 KB Permissions: User: rwx (Read, Write, Execute) Group: rw (Read, Write) Others: r (Read) Time, Date,nd User ID: 2024-09-05 23:53, yourusername FMS Page 2 FILE OPERATIONS Creating a File: It's like adding a new book to the library. 1. Finding Space: The computer needs to find a free shelf (space) on the hard drive big enough for your new book. 2. Cataloging the Book: The computer needs to create a library card (directory entry{ Your File's ID Card } for your new book with its title (file name), author (file type), and location (where it's on the shelf). ( Whenever you create a file, the file system doesn't just throw the data onto the hard drive randomly. It carefully creates a directory entry (your "File ID") to keep track of all the essential information about that file. This is how the operating system can locate, access, and manage your files effectively. ) Writing to a File: (a system call is used to write a file) Imagine: You're writing a story in the book. ○ File Identifier: The computer has a special bookmark (file identifier) that tells it exactly which book you're working with. ○ Writing: You give the computer the text you want to write (the data), and it carefully adds it to the book, one word at a time. ○ Write Pointer: The computer uses a little marker (write pointer) to keep track of where it's currently writing in the book. It moves the pointer as you add new text. Reading a File: ( a system call is used to read a file) Imagine: You're reading the story you wrote in the book. ○ File Identifier: You again use the bookmark (file identifier) to tell the computer which book you want to read. ○ Reading: The computer grabs the text from the book, one word at a time, and displays it on your screen. ○ Read Pointer: Similar to the write pointer, there's a read pointer that keeps track of where you are in the book. As you read, the pointer moves along the words. Repositioning in a File: Imagine: You're flipping through the pages of the book, going back and forth. (Process of moving the read / write pointer in the file or moving through the directory entries ○ Moving the Pointers: The computer can move the write pointer (to write at a different spot) or the read pointer (to read a different part of the story) within the book. It's like using your finger to move along the pages or jumping to a different section. Deleting a File: Imagine: You're removing the book from the library. ○ Freeing Space: The computer marks the shelf where the book was as empty, so it can be used for something else. ○ Removing the Entry: The computer also removes the library card (directory entry) for the book, so it's no longer listed in the catalog. Truncating a File: Imagine: You're cutting out part of your story from the book. ○ Removing Data: The computer deletes the data from the book after a certain point, like cutting out all the pages after a specific chapter. ○ Keeping the Entry: But the computer keeps the book's library card (directory entry) because the book is still there, even though it's empty. Pointers are like Bookmarks for Data: Pointers (both write and read pointers) are like special bookmarks within a file. They tell the computer where it is in the file and where to write or read the next piece of data. They're essential for keeping track of data in files, just like bookmarks help you keep track of your place in a book! Open Files FMS Page 3 1. File Pointer: Imagine: It's like a bookmark in a book. Purpose: The file pointer keeps track of where the operating system is currently reading from or writing to in a file. It's essential for navigating within a file, just like a bookmark helps you find your place in a book. How It Works: When a program wants to read or write to a file, the operating system uses the file pointer to know where to start and where to move next. 2. File Open Count: Imagine: It's like the number of people currently borrowing a book from the library. Purpose: The file open count tracks how many programs have the file open at any given time. How It Works: Each time a program opens a file, the file open count is incremented. When a program closes a file, the count is decremented. This is important to prevent multiple programs from accidentally changing the file at the same time, which could cause data corruption. 3. Disk Location of the File: Imagine: This is the library shelf number where the book is stored. Purpose: The disk location tells the operating system exactly where on the hard drive the file is physically stored. How It Works: The operating system keeps a directory (like a library catalog) that maps file names to their disk locations. When a program needs to access a file, the operating system uses this directory to find its location on the hard drive. 4. Access Rights (Permissions): Imagine: It's like the rules for borrowing a book. Purpose: Access rights determine who can access a file and what they can do with it. How It Works: The operating system assigns permissions to each file, such as: ○ Read: Allows users to view the contents of the file. ○ Write: Allows users to modify the contents of the file. ○ Execute: Allows users to run the file if it's a program. ○ Delete: Allows users to remove the file. ○ Owner: The user who created the file typically has full control over its permissions. In Simple Terms: These four concepts (file pointer, file open count, disk location, and access rights) work together to ensure that the operating system can efficiently manage files, prevent data corruption, and control who can access and modify them. Information Types Files types refers to the type of information stored in files ! File Extension: Imagine: The book's genre (fiction, non-fiction, etc.). Purpose: This part of the file name usually tells the operating system what kind of data is stored in the file. It helps determine the correct program to use to open the file. Examples: ○.txt for plain text documents ○.pdf for Adobe Portable Document Format files ○.jpg for JPEG image files Magic Numbers: Imagine: A special code hidden inside the book that identifies the book's language (English, Spanish, etc.). Purpose: Magic numbers are unique patterns of bytes (like a secret code) that are usually found FMS Page 4 Purpose: Magic numbers are unique patterns of bytes (like a secret code) that are usually found at the beginning of a file. They tell the operating system what type of data is in the file, even if the file extension is missing or incorrect. How They Work: When you open a file, the operating system might check its magic number to verify the file type. Example: ○ A.pdf file usually starts with %PDF-1.x (where x is a version number). Why are These Important? These information types help the operating system: Organize files: Files can be grouped by their type (like putting all the fiction books on one shelf). Open files correctly: The operating system knows which program to use to open a file based on its extension or magic number. Protect data: Magic numbers can help prevent malicious software from disguising itself as a different type of file. In Simple Terms: Think of these information types as labels that the operating system uses to understand and manage files. They're essential for keeping things organized and secure! FMS Page 5

Use Quizgecko on...
Browser
Browser