For this homework, your task is to develop kernels called SPIMOS_GTU_X.s that will perform interrupt handling, multiprogramming and context switching in assembly language. Your new kernel will again be loaded as an assembly file as SPIMOS_GTU_1.s, SPIMOS_GTU_2.s, or SPIMOS_GTU_3.s.
What we expect from your new OS is
1) Handling multi-programming: you need to develop a Process Table in assembly code that will hold the necessary information about the processes in the memory. This assembly code and data structure will be in your kernel files.
2) Handling Interrupts: Our simulator will generate interrupts(SPIM_timerHandler), and your kernel will handle the interrupts in assembly.
3) Implementing the POSIX system calls fork, waitpid, execve, any other POSIX call that you need. These system calls will be implemented in syscall.cpp using C language.
4) Loading multiple programs into memory: Kernel will be able to load multiple programs into memory. This operation will be a system call.
5) Perform Round Robin scheduling: Every time a timer interrupt occurs, there is a chance to make a process switch as previous homework.
6) Whenever a context scheduling occurs, you will print all the information about the processes in process table including but not limited to the entries in the list below.
a. ProcessID
b. ProcessName,
c. Programcounter
d. Stack Pointeraddress
Life-Cycle
You will implement 3 different flavors of MicroKernel (SPIMOS_GTU_1.s, SPIMOS_GTU_2.s, and SPIMOS_GTU_3.s). Don’t worry 90 percent of the code is same between the Micro Kernels. We further explain the details below.
When your kernel is loaded your OS will start a process named init with process id 0. In different Micro Kernels Init process will load programs into memory differently
➢ In the first strategy init process will initialize Process Table, load 4 different programs (listed below) to the memory start them and will enter an infinite loop until all the processes terminate.
➢ Second strategy is randomly choosing one of the programs and loads it into memory 5 times (Same program 5 different processes), start them and will enter an infinite loop until all the processes terminate.
➢ Final Strategy is choosing 3 out 4 programs randomly and loading each program 3 times start them and will enter an infinite loop until all the processes terminate.
➢ When SPIM starts, it immediately loads the MicroKernel file given by commandline parameters example EX: ./spim –ef exceptions.s -file SPIMOS_GTU_1.s
➢ For every timer interrupt, OS should handle the interrupt and perform round robin scheduling.
➢ Your programs finish execution it will acknowledge its termination by calling POSIX PROCESS_EXIT.
➢ Emulator will shut down only after all the programs in memory terminate.
Assembly Files You will supply us with four different Assembly Files
➢ BinarySearch.s
➢ LinearSearch.s
➢ Collatz.s: You are going to find collatz sequence for each number less than 25. You should do this starting from 25 to 1 iteratively (Not only for 1 number). You can find information about (Collatz conjecture on internet). For each number you will show the number being interested in, and its collatz sequence and go to next number.
➢ Palindrome.s: Create a dictionary that contains 100 words, where 90 of the words are not palindrome, 10 of them are palindrome. You do not have to create the dictionary by taking from the user. Then, you will print out each word and whether they are palindrome or not respectively. When you assign all the words in the dictionary whether palindrome or not, then you ask for the user continue or not, if yes, take an input word and show whether a string given from keyboard is a palindrome by printing the “string” semicolon: “Palindrome” or “Not Palindrome”. Otherwise terminate the program.
Output of the dictionary
1: aba: Palindrome
2: how: Not Palindrome
3: book: Not Palindrome
4: ada: Palindrome
5: arthas: Not Palindrome
…
…
…
100: last: Not Palindrome
Do you want to continue (y/n)?
y
Please enter the last word:
Ilhan
101: Ilhan: Not Palindrome
Goodbye…
Your homework template includes several code and sample files. Here is a description for them. Do not change SPIM files except syscall.cpp and do not send these files with your homework. Study these files to understand SPIM.