added README
This commit is contained in:
		
							
								
								
									
										
											BIN
										
									
								
								.gallery/demand-paging.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.gallery/demand-paging.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 103 KiB | 
							
								
								
									
										
											BIN
										
									
								
								.gallery/disk-scheduling.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.gallery/disk-scheduling.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 53 KiB | 
							
								
								
									
										46
									
								
								.gallery/gallery.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								.gallery/gallery.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,46 @@ | ||||
| import json | ||||
| import os | ||||
| import subprocess | ||||
|  | ||||
|  | ||||
| def compile(root_path): | ||||
|     subprocess.run([ | ||||
|         "typst", | ||||
|         "c", | ||||
|         "--root="+root_path, | ||||
|         os.path.join(root_path, ".gallery", "gallery.typ"), | ||||
|         os.path.join(root_path, ".gallery", "page-{n}.png") | ||||
|     ]) | ||||
|  | ||||
|  | ||||
| def query(root_path): | ||||
|     proc = subprocess.run([ | ||||
|         "typst", | ||||
|         "query", | ||||
|         "--root="+root_path, | ||||
|         os.path.join(root_path, ".gallery", "gallery.typ"), | ||||
|         "metadata" | ||||
|     ], capture_output=True) | ||||
|     return json.loads(proc.stdout) | ||||
|  | ||||
|  | ||||
| def main(): | ||||
|     root_path = os.path.abspath( | ||||
|         os.path.join( | ||||
|             os.path.dirname(__file__), | ||||
|             os.path.pardir | ||||
|         ) | ||||
|     ) | ||||
|      | ||||
|     compile(root_path) | ||||
|     metadata = query(root_path) | ||||
|     for entry in metadata: | ||||
|         name = entry["value"]["name"] | ||||
|         page = entry["value"]["page"] | ||||
|         from_path = os.path.join(root_path, ".gallery", f"page-{page}.png") | ||||
|         to_path = os.path.join(root_path, ".gallery", f"{name}.png") | ||||
|         os.rename(from_path, to_path) | ||||
|  | ||||
|  | ||||
| if __name__ == "__main__": | ||||
|     main() | ||||
							
								
								
									
										63
									
								
								.gallery/gallery.typ
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								.gallery/gallery.typ
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,63 @@ | ||||
| #set page(height: auto, margin: 1cm) | ||||
| #set text(font: "Source Sans 3") | ||||
|  | ||||
| #let subject(name) = context { | ||||
|   metadata((name: name, page: locate(here()).page())) | ||||
| } | ||||
|  | ||||
| ////////////////////////// | ||||
| //  Process Scheduling  // | ||||
| ////////////////////////// | ||||
| #subject("process-scheduling") | ||||
| #import "/process-scheduling/utils.typ": task, display-processes | ||||
| #import "/process-scheduling/algorithms.typ": FCFS | ||||
| #let tasks = { | ||||
|   task(1, 0, 10, 3) | ||||
|   task(2, 20, 40, 2) | ||||
|   task(3, 30, 20, 2) | ||||
|   task(4, 60, 10, 3) | ||||
|   task(5, 80, 30, 1) | ||||
|   task(6, 90, 20, 1) | ||||
|   task(7, 100, 50, 3) | ||||
|   task(8, 130, 30, 2) | ||||
|   task(9, 180, 10, 3) | ||||
|   task(10, 200, 60, 1) | ||||
| } | ||||
| #display-processes(..FCFS(tasks)) | ||||
| #pagebreak() | ||||
|  | ||||
| ///////////////////// | ||||
| //  Demand Paging  // | ||||
| ///////////////////// | ||||
| #subject("demand-paging") | ||||
| #import "/demand-paging/utils.typ": sim-demand-paging | ||||
| #set page(width: auto) | ||||
| #let requests = (7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0 , 1) | ||||
| #sim-demand-paging(requests, "FIFO") | ||||
| #pagebreak() | ||||
|  | ||||
| /////////////////////// | ||||
| //  Disk Scheduling  // | ||||
| /////////////////////// | ||||
| #subject("disk-scheduling") | ||||
| #import "/disk-scheduling/algorithms.typ": schedule-fcfs | ||||
| #import "/disk-scheduling/utils.typ": draw-algo, compute-total | ||||
|  | ||||
| #let places = (53, 98, 193, 37, 14, 124, 65, 67) | ||||
| #let min = 0 | ||||
| #let max = 199 | ||||
|  | ||||
| #let result = schedule-fcfs(places) | ||||
| #let graph = draw-algo(result, min: min, max: max, width: 10) | ||||
| #let compute-total = compute-total.with(min: min, max: max) | ||||
|  | ||||
| #table( | ||||
|   columns: 2, | ||||
|   inset: 0.5em, | ||||
|   align: center + horizon, | ||||
|   rotate( | ||||
|     -90deg, | ||||
|     reflow: true | ||||
|   )[*FCFS* (total: #compute-total(result, wrap: false))], | ||||
|   graph | ||||
| ) | ||||
							
								
								
									
										
											BIN
										
									
								
								.gallery/process-scheduling.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.gallery/process-scheduling.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 129 KiB | 
							
								
								
									
										20
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| # Tasty TacOS | ||||
|  | ||||
| This repo compiles some visualizations of algorithms from the OS course. | ||||
|  | ||||
| Here is a little showcase of the different kinds of algorithms in the repo | ||||
|  | ||||
| ## Process scheduling | ||||
| <img src="./.gallery/process-scheduling.png"> | ||||
|  | ||||
| [See more](process-scheduling/) | ||||
|  | ||||
| ## Demand paging | ||||
| <img src="./.gallery/demand-paging.png"> | ||||
|  | ||||
| [See more](demand-paging/) | ||||
|  | ||||
| ## Disk scheduling | ||||
| <img src="./.gallery/disk-scheduling.png"> | ||||
|  | ||||
| [See more](disk-scheduling/) | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user