Skip to content

Commit

Permalink
Updated Solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
Gautam8387 committed Aug 9, 2023
1 parent b5170c6 commit 3ee6848
Show file tree
Hide file tree
Showing 256 changed files with 89 additions and 0 deletions.
6 changes: 6 additions & 0 deletions assignment-1/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.c.o:
gcc -c $*.c
hello: main.o dumb.o
gcc -o hello main.o dumb.o
main.o: main.c dumb.h
dumb.o: dumb.c dumb.h
7 changes: 7 additions & 0 deletions assignment-1/dumb.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include<stdio.h>
#include "dumb.h"

void dumb(int n, int m)
{
printf("n*m = %d\n", n*m);
}
1 change: 1 addition & 0 deletions assignment-1/dumb.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
void dumb(int n, int m);
Binary file added assignment-1/dumb.o
Binary file not shown.
Binary file added assignment-1/hello
Binary file not shown.
9 changes: 9 additions & 0 deletions assignment-1/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include<stdio.h>
#include "dumb.h"
int main()
{
printf("%s", "Hello World!\n");
dumb(23,3);

return 0;
}
Binary file added assignment-1/main.o
Binary file not shown.
12 changes: 12 additions & 0 deletions assignment-1/myhello.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include<stdio.h>
#include "myhello.h"
int main()
/* this is a comment */
{
int i;
/* What is the statement below doing?*/
printf("%s", "Hello World!\n");
i = VAL;
printf("%d \n", i);
return 0;
}
1 change: 1 addition & 0 deletions assignment-1/myhello.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const int VAL = 3;
4 changes: 4 additions & 0 deletions assignment-1/test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.c.o:
gcc -c -g $*.c
test: test.o
gcc -o test test.o
Binary file added assignment-1/test/test
Binary file not shown.
9 changes: 9 additions & 0 deletions assignment-1/test/test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include<stdio.h>

int main(){
int i=23;
//scanf("Input a number: ",%i);
int m = i*i;
printf("Square of %d is: %d\n", i, m);
return 0;
}
Binary file added assignment-1/test/test.o
Binary file not shown.
Binary file added lecture-slides/01-osintro.pdf
Binary file not shown.
Binary file added lecture-slides/02-process.pdf
Binary file not shown.
Binary file added lecture-slides/03-processwrap.pdf
Binary file not shown.
Binary file added lecture-slides/04-processapi.pdf
Binary file not shown.
Binary file added lecture-slides/05-pipe-ctxswt-2023.pdf
Binary file not shown.
Binary file added lecture-slides/06-ctxswt-2023.pdf
Binary file not shown.
Binary file added lecture-slides/07-ctxswt-2023.pdf
Binary file not shown.
Binary file added lecture-slides/08-ctx-cpumulti-2023.pdf
Binary file not shown.
Binary file added lecture-slides/09-schedule-2023.pdf
Binary file not shown.
Binary file added lecture-slides/10-sched-policy-2023.pdf
Binary file not shown.
Binary file added lecture-slides/11-mlfq-2023.pdf
Binary file not shown.
Binary file added lecture-slides/12-vm-intro-2023.pdf
Binary file not shown.
Binary file added lecture-slides/13-vm-cont-2023.pdf
Binary file not shown.
Binary file added lecture-slides/14-bb-segment-2023.pdf
Binary file not shown.
Binary file added lecture-slides/15-pag-swap.pdf
Binary file not shown.
Binary file added lecture-slides/16-pages-pte-2023.pdf
Binary file not shown.
Binary file added lecture-slides/17-swap-freespacemgmt-2023.pdf
Binary file not shown.
Binary file added lecture-slides/18-swap-freespace-2023.pdf
Binary file not shown.
Binary file added lecture-slides/19-synchro-primitives-2023.pdf
Binary file not shown.
Binary file added lecture-slides/20-syncro-prim-2023.pdf
Binary file not shown.
Binary file added lecture-slides/21b-fs-2023.pdf
Binary file not shown.
Binary file added lecture-slides/22-files-2023.pdf
Binary file not shown.
Binary file added lecture-slides/23-files-n-dirs-2023.pdf
Binary file not shown.
Binary file added lecture-slides/24-fs-datastructs-2023.pdf
Binary file not shown.
Binary file added solutions/assignment-1/Assignment-1.pdf
Binary file not shown.
Binary file not shown.
Binary file added solutions/assignment-1/images/1-2-a.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-1/images/1-2-b.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-1/images/1-3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-1/images/1-4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-1/images/1-5-1-b.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-1/images/1-5-1-c.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-1/images/1-5-1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-1/images/1-5-s.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-1/images/1-6-1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-1/images/1-6-2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-1/images/1-6-3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-1/images/1-7-1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-1/images/1-7-3 [SOURCE].jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-1/images/1-7-3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-1/images/1-7-file.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-1/images/1-7-nm.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-1/images/1-7-od.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-2/Assignment-2.pdf
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-2/images/7-disk-io.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-2/images/7-disk-top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-2/images/7-disk1-io.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-2/images/7-disk1-top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-3/Assignment 3.pdf
Binary file not shown.
Binary file not shown.
Binary file added solutions/assignment-3/images/boot-00.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-3/images/boot-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-3/images/boot-010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added solutions/assignment-3/images/boot-02.png
Binary file added solutions/assignment-3/images/boot-03.png
Binary file added solutions/assignment-3/images/exe0-info-reg.png
Binary file added solutions/assignment-3/images/exe0-part-2-0.png
Binary file added solutions/assignment-3/images/exe0-part-2-1.png
Binary file added solutions/assignment-3/images/exe0-part-2.png
Binary file added solutions/assignment-3/images/exe0-part3.png
Binary file added solutions/assignment-3/images/exe0-stack.png
Binary file added solutions/assignment-3/images/exe1-0.png
Binary file added solutions/assignment-3/images/exe1-output.png
Binary file added solutions/assignment-3/images/exe1-syscall-h.png
Binary file added solutions/assignment-3/images/exe1-tf-def.png
Binary file added solutions/assignment-3/images/exe1-tf-exa.png
Binary file added solutions/assignment-3/images/exe1-tf-myproc.png
Binary file added solutions/assignment-3/images/exe2-argptr.png
Binary file added solutions/assignment-3/images/exe2-grep.png
Binary file added solutions/assignment-3/images/exe2-makefile.png
Binary file added solutions/assignment-3/images/exe2-output.png
Binary file added solutions/assignment-3/images/exe2-syscall-h.png
Binary file added solutions/assignment-3/images/exe2-sysproc.png
Binary file added solutions/assignment-3/images/exe2-user-h.png
Binary file added solutions/assignment-3/images/exe2-usys-s.png
Binary file added solutions/lab-1/CS1217-Spring-2023-Lab-1.pdf
Binary file not shown.
Binary file added solutions/lab-1/Gautam_Ahuja_CS1217_Lab1.pdf
Binary file not shown.
Binary file added solutions/lab-1/images/exe-7-change.png
Binary file added solutions/lab-1/images/exe10-test-backtrace.png
Binary file added solutions/lab-1/images/exe11-code.png
Binary file added solutions/lab-1/images/exe11-output.png
Binary file added solutions/lab-1/images/exe12-mon-back-track.png
Binary file added solutions/lab-1/images/exe12-new-command.png
Binary file added solutions/lab-1/images/exe12-objdump-kernel-D.png
Binary file added solutions/lab-1/images/exe12-objdump-kernel-h.png
Binary file added solutions/lab-1/images/exe12-output.png
Binary file added solutions/lab-1/images/exe12-stab-binary.png
Binary file added solutions/lab-1/images/exe12-stab-kernel.png
Binary file added solutions/lab-1/images/exe12-stab-section.png
Binary file added solutions/lab-1/images/exe2-boot-asm.png
Binary file added solutions/lab-1/images/exe2-boot-main-c.png
Binary file added solutions/lab-1/images/exe2-si-2.png
Binary file added solutions/lab-1/images/exe2-si.png
Binary file added solutions/lab-1/images/exe3-1-32bit-asm.png
Binary file added solutions/lab-1/images/exe3-1-32bit-s.png
Binary file added solutions/lab-1/images/exe3-2-entry-asm.png
Binary file added solutions/lab-1/images/exe3-2-entry-s.png
Binary file added solutions/lab-1/images/exe3-4-elf-h.png
Binary file added solutions/lab-1/images/exe3-4-readseg-c.png
Binary file added solutions/lab-1/images/exe3-4-seg-c.png
Binary file added solutions/lab-1/images/exe3-bootloader-si.png
Binary file added solutions/lab-1/images/exe3-entrypoint-si.png
Binary file added solutions/lab-1/images/exe3-forloop-asm.png
Binary file added solutions/lab-1/images/exe3-forloop-c.png
Binary file added solutions/lab-1/images/exe3-readsect-asm.png
Binary file added solutions/lab-1/images/exe3-readsect-c.png
Binary file added solutions/lab-1/images/exe4-pointers-c.png
Binary file added solutions/lab-1/images/exe5-boot-fail.png
Binary file added solutions/lab-1/images/exe5-makefile.png
Binary file added solutions/lab-1/images/exe5-objdump-boot.png
Binary file added solutions/lab-1/images/exe5-objdump.png
Binary file added solutions/lab-1/images/exe6-mem-values.png
Binary file added solutions/lab-1/images/exe7-2-change.png
Binary file added solutions/lab-1/images/exe7-kern-asm.png
Binary file added solutions/lab-1/images/exe7-mem-check.png
Binary file added solutions/lab-1/images/exe8-3-init.png
Binary file added solutions/lab-1/images/exe8-3-kern.png
Binary file added solutions/lab-1/images/exe8-3-print.png
Binary file added solutions/lab-1/images/exe8-5-output.png
Binary file added solutions/lab-1/images/exe8-octal-result.png
Binary file added solutions/lab-1/images/exe8-octal.png
Binary file added solutions/lab-1/images/exe9-stack-entry-s.png
Binary file added solutions/lab-1/images/exe9-stack-kernel-asm.png
Binary file added solutions/lab-1/images/exe9-stack-start.png
Binary file added solutions/lab-2/CS1217-Spring-2023-Lab2.pdf
Binary file not shown.
Binary file added solutions/lab-2/Gautam_Ahuja_CS1217_Lab2.pdf
Binary file not shown.
Binary file added solutions/lab-2/images/1-1-procstate.png
Binary file added solutions/lab-2/images/1-3-procstate-var.png
Binary file added solutions/lab-2/images/2-1-code.png
Binary file added solutions/lab-2/images/2-2-switchuvm.png
Binary file added solutions/lab-2/images/2-3-switchkvm.png
Binary file added solutions/lab-2/images/2-4-swtch.png
Binary file added solutions/lab-2/images/3-1-allocproc.png
Binary file added solutions/lab-2/images/3-1-fork.png
Binary file added solutions/lab-2/images/3-3-copyuvm.png
Binary file added solutions/lab-2/images/4-1-exit.png
Binary file added solutions/lab-2/images/I-1-syscall-h.png
Binary file added solutions/lab-2/images/I-10-getpriority.png
Binary file added solutions/lab-2/images/I-11-1-proc-h.png
Binary file added solutions/lab-2/images/I-11-2-fork.png
Binary file added solutions/lab-2/images/I-2-1-syscall-c.png
Binary file added solutions/lab-2/images/I-2-2-syscall-c.png
Binary file added solutions/lab-2/images/I-3-user-h.png
Binary file added solutions/lab-2/images/I-4-usys-S.png
Binary file added solutions/lab-2/images/I-5-sysproc-c.png
Binary file added solutions/lab-2/images/I-6-1-proc-h.png
Binary file added solutions/lab-2/images/I-6-2-proc-h.png
Binary file added solutions/lab-2/images/I-7-param-h.png
Binary file added solutions/lab-2/images/I-8-2-def-h.png
Binary file added solutions/lab-2/images/I-8-makefile.png
Binary file added solutions/lab-2/images/I-9-setpriority.png
Binary file added solutions/lab-2/images/allocproc-1.png
Binary file added solutions/lab-2/images/allocproc-fork-1.png
Binary file added solutions/lab-2/images/lottery-1-syscall-1.png
Binary file added solutions/lab-2/images/lottery-1-syscall-2.png
Binary file added solutions/lab-2/images/lottery-10-algos.png
Binary file added solutions/lab-2/images/lottery-2-proc-h.png
Binary file added solutions/lab-2/images/lottery-3-pstat-h.png
Binary file added solutions/lab-2/images/lottery-4-rand-h.png
Binary file added solutions/lab-2/images/lottery-5-alloc.png
Binary file added solutions/lab-2/images/lottery-6-fork.png
Binary file added solutions/lab-2/images/lottery-7-seed.png
Binary file added solutions/lab-2/images/lottery-8-counters.png
Binary file added solutions/lab-2/images/lottery-9-pstat-update.png
Binary file added solutions/lab-2/images/mlfq-after-budget.png
Binary file added solutions/lab-2/images/mlfq-before-budget.png
Binary file added solutions/lab-2/images/mlfq-fork-1.png
Binary file added solutions/lab-2/images/mlfq-queue.png
Binary file added solutions/lab-2/images/mlfq-wakeup1.png
Binary file added solutions/lab-2/images/priority-1.png
Binary file added solutions/lab-2/images/priority-2-1.png
Binary file added solutions/lab-2/images/priority-2.png
Binary file added solutions/lab-2/images/priority-3-1.png
Binary file added solutions/lab-2/images/priority-3-2.png
Binary file added solutions/lab-2/images/test-lottery.png
Binary file added solutions/lab-2/images/test-mlfq.png
Binary file added solutions/lab-2/images/test-original.png
Binary file added solutions/lab-2/images/tester-CPU.png
Binary file added solutions/lab-2/images/tester-IO.png
Binary file added solutions/lab-2/images/tester-makefile.png
40 changes: 40 additions & 0 deletions solutions/lab-2/scheduler - commented
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
void
scheduler(void)
{
struct proc *p;
struct cpu *c = mycpu();
c->proc = 0;

for(;;){
// Enable interrupts on this processor.
// STI — Set Interrupt Flag
sti();

// Loop over process table looking for process to run.
acquire(&ptable.lock);
// the &ptable.proc[NPROC] is the address of the last element of the ptable.proc array.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->state != RUNNABLE)
continue;

// Switch to chosen process. It is the process's job
// to release ptable.lock and then reacquire it
// before jumping back to us.
c->proc = p;
// the switchuvm(p) will do the switching of the kernel virtual memory to the process's virtual memory.
switchuvm(p);
p->state = RUNNING;
// Now the process is running, so we can switch to it.
// The swtch(&(c->scheduler), p->context) is the content switch. It will save the current context and load the new context.
swtch(&(c->scheduler), p->context);
// The switchkvm function will switch the kernel virtual memory to the process's virtual memory.
switchkvm();

// Process is done running for now.
// It should have changed its p->state before coming back.
c->proc = 0;
}
release(&ptable.lock);

}
}
Binary file added solutions/lab-3/CS1217-Spring-2023-Lab-3.pdf
Binary file not shown.
Binary file added solutions/lab-3/Gautam_Ahuja_CS1217_Lab3.pdf
Binary file not shown.
Binary file added solutions/lab-3/images/1-1-kernbase.png
Binary file added solutions/lab-3/images/1-2-Page-mmu.png
Binary file added solutions/lab-3/images/1-3-kernel-stack.png
Binary file added solutions/lab-3/images/1-A-1-bootalloc.png
Binary file added solutions/lab-3/images/1-A-2-bootalloc.png
Binary file added solutions/lab-3/images/1-A-ROUNDUP.png
Binary file added solutions/lab-3/images/1-B-mem-init.png
Binary file added solutions/lab-3/images/1-B-memset.png
Binary file added solutions/lab-3/images/1-C-LL.png
Binary file added solutions/lab-3/images/1-C-page-init.png
Binary file added solutions/lab-3/images/1-D-pagealloc.png
Binary file added solutions/lab-3/images/1-E-pagefree.png
Binary file added solutions/lab-3/images/1-END.png
Binary file added solutions/lab-3/images/2-1.png
Binary file added solutions/lab-3/images/2-2.png
Binary file added solutions/lab-3/images/3-GDB-2.png
Binary file added solutions/lab-3/images/3-GDB.png
Binary file added solutions/lab-3/images/3-info-mem.png
Binary file added solutions/lab-3/images/3-info-pg.png
Binary file added solutions/lab-3/images/4-1-page-walk.png
Binary file added solutions/lab-3/images/4-2-boot-map-region.png
Binary file added solutions/lab-3/images/4-3-page-lookup.png
Binary file added solutions/lab-3/images/4-4-page-remove.png
Binary file added solutions/lab-3/images/4-5-page-insert.png
Binary file added solutions/lab-3/images/4-END.png
Binary file added solutions/lab-3/images/4-mmu-1.png
Binary file added solutions/lab-3/images/4-mmu-2.png
Binary file added solutions/lab-3/images/4-mmu-3.png
Binary file added solutions/lab-3/images/5-1-1.png
Binary file added solutions/lab-3/images/5-1-2.png
Binary file added solutions/lab-3/images/5-1-3.png
Binary file added solutions/lab-3/images/5-2-1-info-pg.png
Binary file added solutions/lab-3/images/5-END.png
Binary file added solutions/lab-3/images/6-1.png
Binary file added solutions/lab-3/images/6-2.png
Binary file added solutions/lab-3/images/6-3.png
Binary file added solutions/lab-3/images/6-END.png
Binary file added solutions/lab-3/images/6-MEM-INIT.png
Binary file added solutions/lab-3/images/6-boot.png
Binary file added solutions/lab-3/images/6-check2va.png
Binary file added solutions/lab-3/images/6-i386.png
Binary file added solutions/lab-3/images/6-mmu-1.png
Binary file added solutions/lab-3/images/6-mmu-2.png
Binary file added solutions/lab-3/images/6-mmu-3.png
Binary file added solutions/lab-3/images/7-dump-1.png
Binary file added solutions/lab-3/images/7-mapping-1.png
Binary file added solutions/lab-3/images/7-mapping-2.png
Binary file added solutions/lab-3/images/7-mapping-3.png
Binary file added solutions/lab-3/images/7-mapping-4.png
Binary file added solutions/lab-3/images/7-mapping-5.png
Binary file added solutions/lab-3/images/7-setperm-end.png
Binary file added solutions/zines/Gautam_Ahuja_Zines.pdf
Binary file not shown.

0 comments on commit 3ee6848

Please sign in to comment.