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. ^.^
Any one know NachOS ??
Re: Any one know NachOS ??
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
synch.cc
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
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;
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() {}
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 ??
HELLO...this topic was made five years ago,
look at the date man.
look at the date man.
The man who follows the crowd will usually get no further than the crowd.
The man who walks alone is likely to find himself in places
no one has ever been before.
The man who walks alone is likely to find himself in places
no one has ever been before.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Any one know NachOS ??
Let alone that the author won't see *any* mails about that you replied.
Best contact him ouside the forum.
Best contact him ouside the forum.