Tuesday, January 6, 2009

iceSapphire's tribute to "Not Another Completely Heuristic Operating System" (NACHOS)

Not Another Completely Heuristic Operating System, often abbreviated as NACHOS, is instructional software for teaching and learning operating system. It is not a complete operating system but is a simulation, which runs as a single process on another (preferably POSIX) operating system.

Installation

Here goes the procedure to install NACHOS in a Linux system,

·         Copy nachos compiler (.../nachos/compiler) to /user/local

Next is to compile nachos.  So, forward to,

·         Copy another nachos folder (.../nachos/ nachos) to any folder under the root directory (/).

*        This .../nachos/ nachos has a folder named coff2noff

*        Say we placed it at /

·         Start terminal

·         Go to the directory  /nachos/coff2noff and make it using the command

#         make

*        It will make OS binaries

·         Go to /nachos/code/test and make it using the command

#         make  

*        It will make text binaries

·         Go to /nachos/code/build.linux  and make it using commands,

#         make depend

#         make

*        It will build nachos

·         Now execute nachos by issuing the command

#         ./nachos –u

*        It will show some information about the compiled nachos

*        By now nachos is successfully compiled and run

·         Run a test nachos executable

#         ./nachos -x /nachos/code/test/file.io.o

*        So, a test file is also executed.

Run a modified file under the userprog directory

·         Go to /nachos/code/userprog/ and open a create a new *.cc and a new *.h file say new.cc and new.h as coded below,

new.h

#include

class SevenToTwelve{

public:    

void check();

};

new.cc

#include “new.h”

void SevenToTwelve::check(){

cout<<“this is kuetCSE2k5”;

}

·         Now this file is to be called from the main function of nachos.

·         Go to /nachos/code/threads/main.cc and append

                                #include “new.h”

Into include file section

·         Go to line309 and append

else if (strcmp(argv[i],”-13”)==0){

      SevenToTwelve sttObject;

sttObject.check();

      }

 

·         Go to /nachos/code/build.linux/makefile and add the new.cc , new.h and new.o in the specific section, like this,

 

USERPROG_H = ../userprog/addrspace.h\

      ../userprog/syscall.h\

      ../userprog/synchconsole.h\

      ../userprog/noff.h\

      ../userprog/errno.h\

      ../userprog/proctable.h\

      ../userprog/synchbitmap.h\

      ../userprog/table.h\

      ../userprog/new.h

 

USERPROG_C = ../userprog/addrspace.cc\

      ../userprog/exception.cc\

      ../userprog/synchconsole.cc\

      ../userprog/proctable.cc\

      ../userprog/synchbitmap.cc\

      ../userprog/table.cc\

      ../userprog/new.cc

 

USERPROG_O = addrspace.o exception.o synchconsole.o\

      proctable.o synchbitmap.o table.o\

      new.o

 

·         Go to /nachos/ code/ build.linux and recompile nachos using

#         make depend

#         make

·         From the console go to /nachos/ code/ build.linux and run the command

#         ./nachos -13

*        The output is

 

this is kuetCSE2k5

Thus, a user defined code snippet has been executed in nachos.

 

 N.B.: Make clean command may be used to clean the files from folder that were created while compiling.

And i will say more...

As new machines built on IC7 chips do not support fedora core versions prior to fc6, we could not install fedora 5. Again, nachos do not install on fedora core 6 or later. Hence, this document has been produced from comparative and imperative decisions. In addition, it may differ from the actual scenario.

 

 

Sunday, June 8, 2008

some tricky SQL query

SQL query sometimes go very interesting. With a little bit trick you can do a lot with it. It is like playing a game with words!
To have some fun first download this sql file from http://kuetcse2k5.googlepages.com/course.SQL
and execute it in your DBMS.

Now try to answer the following:
(Presented from a set of question by
Rushdi Shams,
Lecturer,Dept of CSE,KUET,BD
http://rushdishams.googlepages.com/
)

1. See all the data in instructor table. Use only SUM and COUNT aggregate functions to find out the average salary of the instructors. The answer should be 3791.66667. Validate the answer by using AVG aggregate function.

2. See all the data in site table. Find out the site_id for the location named WASHINGTON. Use LIKE clause. Answer would be 6.

3. From instructor table, find all the instructors and their mentor’s name (hint: requires a self-join or table aliasing). The output will be-

INSTRUCTOR_NAME

MENTOR_NAME

SHELLEY

WAYNE

BOGART

WAYNE

NEWMAN

WAYNE

MONROE

WAYNE

STEEL

CAINE

SPARKS

STEEL

LAUREL

STEEL

LODGE

SPARKS

JOHNSON

SPARKS

TUCKER

SPARKS

4. From instructor table, find all the instructors that have no mentors. The output will be-

INSTRUCTOR_NAME

WAYNE

CAINE

5. From instructor table, find the names who are mentors (hint: you will have to make nested query). The output will be-

INSTRUCTOR_NAME

WAYNE

CAINE

STEEL

SPARKS

6. From instructor table, find the IDs who are not mentors (hint: you may use set operators here). The output will be-

INSTRUCTOR_ID

243

263

453

515

560

628

790

7. in plain English, tell what the following query is doing by running the query and seeing the result. Remember- in plain English!

select a.id, a.value, b.value from data a, data b where a.name_id=9 and a.id=b.id and a.prefix!=b.prefix;

commit;


ANSWERS:
-->1
select sum(salary)/count (salary) from instructor;

-->2
select site_id from site where location like '%WASHINGTON%';

-->3
select i.instructor_name ,m.instructor_name "MENTOR_NAME"
from instructor i join instructor m
on i.mentor_id=m.instructor_id;

-->4
select instructor_name from instructor where mentor_id is null;

-->5
select instructor_name from
instructor where instructor_id in
(select mentor_id from instructor where mentor_id is not null)
order by instructor_name;

-->6
select instructor_id from
instructor where instructor_id not in
(select mentor_id from instructor where mentor_id is not null)
order by instructor_id;

-->7
-->first check the query:
select a.mentor_id, a.salary, b.salary from
instructor a, instructor b
where a.instructor_id=243 and a.mentor_id=b.mentor_id and a.instructor_name!=b.instructor_name;

--> it will select those entries with
--> the name_id=9 and has same id for two different entries.


So check these out!
this blog will be removed! soon
Thanks...