Metadata-Version: 2.4
Name: dulab
Version: 1.0.1
Summary: Operating Systems and Data Structures lab practicals in C++: save programs to a roll-number folder on your Desktop, and run the Linux command practicals in a new terminal
Author: Prateek Yadav
License-Expression: MIT
Keywords: operating systems,data structures,lab,practicals,linux commands,students
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: C++
Classifier: Operating System :: OS Independent
Classifier: Environment :: Console
Classifier: Intended Audience :: Education
Classifier: Topic :: Education
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# dulab

Lab practicals for **Operating Systems (DSC08)** and **Data Structures**.

- **Programs:** pick one from the menu and type your roll number. The program is
  saved to a folder named after your roll number on your Desktop, ready to compile.
- **Linux command practicals (OS 2 and 3):** a new terminal window opens and runs
  every command, one after another, with sample files to work on.

All programs are in C++.

```
Desktop/
└── 23CS045/
    ├── os08_fcfs.cpp
    ├── os11_pthread_sum.cpp
    ├── ds06_binary_search_tree.cpp
    └── ...
```

## Install

```bash
pip install dulab
```

Requires Python 3.8 or newer. To compile the programs you need `g++`
(on Ubuntu: `sudo apt install build-essential`).

## Use

```bash
dulab
```

```
================================================================
  DULAB   v1.0.1   OS and DS lab practicals
================================================================

  1.  Operating Systems (DSC08)  - C++ programs + Linux commands
  2.  Data Structures            - C++ programs
  Q.  Quit

Choose a subject (1, 2, Q): 1

  OPERATING SYSTEMS (DSC08)  (C++)
    2.  Linux commands: information, file and directory management   [opens a terminal]
    3.  Linux commands: process control, communication, protection   [opens a terminal]
    4.  fork(): same code, different code, parent waits
    ...
   12.  First-fit, best-fit and worst-fit allocation

Choose (2-12, A, B, Q): 8
Enter your roll number: 23CS045
  Saved: /home/you/Desktop/23CS045/os08_fcfs.cpp

  To compile and run:
    cd "/home/you/Desktop/23CS045"
    g++ os08_fcfs.cpp -o os08_fcfs
    ./os08_fcfs
```

If Windows says `'dulab' is not recognized`, run `python -m dulab` instead.

### Shortcuts

| Command | What it does |
|---|---|
| `dulab` | Interactive menu |
| `dulab --list` | List every practical |
| `dulab os8 -r 23CS045` | Save OS practical 8 for roll number 23CS045 |
| `dulab ds -r 23CS045` | Save all DS programs (`os` for all OS, `all` for both) |
| `dulab os2` | Open a terminal and run all of OS practical 2 |
| `dulab os3ii` | Run only part (ii) of OS practical 3 |
| `dulab os2 --here` | Run the commands in the current window |
| `dulab --show ds4` | Print a program's code |
| `dulab ... --dir PATH` | Save somewhere other than the Desktop |
| `dulab ... -f` | Overwrite existing files without asking |

## Practicals

**Operating Systems (DSC08)** (practical 1, the OS simulator, is not included)

| No. | Practical | Output |
|---|---|---|
| 2 | Linux commands: wc, clear, cal, who, date, pwd / cat, cp, rm, mv, cmp, comm, diff, find, grep, awk / cd, mkdir, rmdir, ls | terminal |
| 3 | Linux commands: fork, getpid, ps, kill, sleep / redirection, pipes / chmod, chown, chgrp | terminal |
| 4 | fork(): same program same code, same program different code, parent waits for child | 3 programs |
| 5 | Kernel version, CPU type and CPU information | program |
| 6 | Configured, free and used memory | program |
| 7 | Copy a file using system calls | program |
| 8 | FCFS scheduling | program |
| 9 | SJF scheduling (non-preemptive) | program |
| 10 | Non-preemptive priority scheduling | program |
| 11 | Sum of n numbers using Pthreads | program |
| 12 | First-fit, best-fit and worst-fit allocation | program |

**Data Structures**

| No. | Practical |
|---|---|
| 1 | Singly linked list ADT |
| 2 | Doubly linked list ADT |
| 3 | Circular linked list ADT |
| 4 | Stack ADT: evaluate prefix and postfix expressions |
| 5 | Queue ADT |
| 6 | Binary search tree: insert, delete, search, traversals |
| 7 | AVL tree: insert and search |

## Linux commands on Windows and macOS

- **Windows:** the commands run in WSL. If you don't have it, open PowerShell as
  Administrator, run `wsl --install`, restart, and finish the Ubuntu setup.
- **macOS:** the commands open in Terminal.app. A few options differ slightly from Linux.
- **No desktop (e.g. over SSH):** dulab offers to run the commands in the current window.

## Use from Python

```python
import dulab

print(dulab.get_code("os8"))
for item in dulab.SUBJECTS["ds"]["items"]:
    print(item["id"], item["title"])
```

## License

MIT
