0
0
Operating Systemsknowledge~30 mins

Directory structure (single-level, two-level, tree, acyclic graph) in Operating Systems - Mini Project: Build & Apply

Choose your learning style9 modes available
Understanding Directory Structures
📖 Scenario: You are learning about how files and folders are organized in computer systems. Different directory structures help organize files in various ways, such as single-level, two-level, tree, and acyclic graph structures.Imagine you are setting up a simple file system to understand these structures better.
🎯 Goal: Build a simple representation of different directory structures using dictionaries and lists to visualize how files and folders are organized.
📋 What You'll Learn
Create a dictionary representing a single-level directory with three files
Add a two-level directory structure with users and their files
Build a tree directory structure with folders and subfolders
Represent an acyclic graph directory structure with shared files
💡 Why This Matters
🌍 Real World
Understanding directory structures helps in managing files efficiently on computers and designing file systems.
💼 Career
Knowledge of directory structures is important for system administrators, software developers, and anyone working with operating systems or file management.
Progress0 / 4 steps
1
Create a Single-Level Directory
Create a dictionary called single_level_dir with these exact entries: 'file1.txt': 100, 'file2.txt': 200, and 'file3.txt': 300. The numbers represent file sizes in KB.
Operating Systems
Need a hint?

Use a dictionary with file names as keys and sizes as values.

2
Add a Two-Level Directory Structure
Create a dictionary called two_level_dir where keys are user names 'Alice' and 'Bob'. Each user has a list of their files: 'Alice' has 'doc1.txt' and 'doc2.txt', 'Bob' has 'image1.png'. Use lists to hold the file names.
Operating Systems
Need a hint?

Use a dictionary with user names as keys and lists of file names as values.

3
Build a Tree Directory Structure
Create a dictionary called tree_dir representing folders and subfolders. The root folder 'root' contains 'folder1' and 'folder2'. 'folder1' contains files 'a.txt' and 'b.txt'. 'folder2' contains a subfolder 'subfolder1' with file 'c.txt'. Use nested dictionaries and lists to represent this structure.
Operating Systems
Need a hint?

Use nested dictionaries for folders and lists for files inside folders.

4
Represent an Acyclic Graph Directory Structure
Create a dictionary called acyclic_graph_dir where 'folderA' contains 'fileX.txt' and a link to 'folderB'. 'folderB' contains 'fileY.txt'. Represent the link by including 'folderB' as a key inside 'folderA' pointing to the same dictionary as 'folderB'. Use nested dictionaries and ensure no cycles are created.
Operating Systems
Need a hint?

Use a shared dictionary object for folderB and reference it inside folderA to represent the link.