Page 1 of 1
Any one know NachOS ??
Posted: Tue Nov 04, 2003 5:17 am
by X-KAM-X
Hi there~
Is there any one know NachOS ?
Do anyone did some project about it?
I am working with it now.
If there's any one tried it before.
Please share some experience with me. Or talk about it here. ^.^
Re: Any one know NachOS ??
Posted: Fri Oct 24, 2008 5:23 am
by PH
I am new in Nachos and i am trying to make a ready example work.
Example: modify the main program of Nachos (main.cc) to implement a “-S” command-line flag for Nachos that invokes the semaphore selftest function.
main.cc
Code: Select all
#define MAIN
#include "copyright.h"
#undef MAIN
#include "utility.h"
#include "system.h"
// Start Changes ++++++++++++++++++++++++++++++++++
extern void SelfTest(void), Copy(char *unixFile, char *nachosFile);
// End Changes +++++++++++++++++++++++++++++++++++++
extern void ThreadTest(void), Copy(char *unixFile, char *nachosFile);
extern void Print(char *file), PerformanceTest(void);
extern void StartProcess(char *file), ConsoleTest(char *in, char *out);
extern void MailTest(int networkID);
#ifdef THREADS
ThreadTest();
#endif
for (argc--, argv++; argc > 0; argc -= argCount, argv += argCount) {
argCount = 1;
if (!strcmp(*argv, "-z")) // print copyright
printf (copyright);
// Start Changes +++++++++++++++++++++++++++++++++++++++++
if (!strcmp(*argv, "-S")) //we compare the string that we enter with “S”
{
SelfTest(); //invoke the semaphore SelfTest function
continue;
}
// End Changes +++++++++++++++++++++++++++++++++++++++++++
#ifdef USER_PROGRAM
if (!strcmp(*argv, "-x")) { // run a user program
ASSERT(argc > 1);
StartProcess(*(argv + 1));
argCount = 2;
synch.cc
Code: Select all
void
Semaphore::V()
{
Thread *thread;
IntStatus oldLevel = interrupt->SetLevel(IntOff);
thread = (Thread *)queue->Remove();
if (thread != NULL) // make thread ready, consuming the V immediately
scheduler->ReadyToRun(thread);
value++;
(void) interrupt->SetLevel(oldLevel);
}
// Start Changes +++++++++++++++++++++++++++++++++++++++++++++++++++
Void SelfTest()
{
Semaphore *a = new Semaphore("ping", 0); // pointer of type semaphore pointing // to a new semaphore “ping” // initialized with dummy variable 0
printf ("Invoking semaphore SelfTest() function\n");
a->SelfTest(); //the actual invoking of the SelfTest funtion
printf ("Semaphore SelfTest() function stopped\n");
}
// End Changes ++++++++++++++++++++++++++++++++++++++++++++++++++
// Dummy functions -- so we can compile our later assignments
// Note -- without a correct implementation of Condition::Wait(),
// the test case in the network assignment won't work!
Lock::Lock(char* debugName) {}
Lock::~Lock() {}
void Lock::Acquire() {}
void Lock::Release() {}
Expected Output: The two printf statements
Actual Output: a normal execution on nachos like the flag wasnt invoked at all
Where is the mistake, why cant i see those outputs?
( Could there be smth wrong with the content of main.cc synch.cc or synch.h )
Waiting for a reply
Ill be online
Re: Any one know NachOS ??
Posted: Fri Oct 24, 2008 7:35 am
by xyjamepa
HELLO...this topic was made five years ago,
look at the date man.
Re: Any one know NachOS ??
Posted: Sat Oct 25, 2008 7:23 am
by Combuster
Let alone that the author won't see *any* mails about that you replied.
Best contact him ouside the forum.