thinkhy / cs162 Goto Github PK
View Code? Open in Web Editor NEWStudy notes for online course UCB CS162
License: BSD 3-Clause "New" or "Revised" License
Study notes for online course UCB CS162
License: BSD 3-Clause "New" or "Revised" License
rm: cannot remove `../test/testVar1.txt': No such file or directory
java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 4194303
at nachos.userprog.UserProcess.readVirtualMemory(UserProcess.java:190)
at nachos.userprog.UserProcess.readVirtualMemory(UserProcess.java:155)
at nachos.userprog.UserProcess.handleWrite(UserProcess.java:657)
at nachos.userprog.UserProcess.handleSyscall(UserProcess.java:1094)
at nachos.userprog.UserProcess.handleException(UserProcess.java:1137)
at nachos.userprog.UserKernel.exceptionHandler(UserKernel.java:106)
at nachos.userprog.UserKernel$1.run(UserKernel.java:43)
at nachos.machine.Processor$MipsException.handle(Processor.java:603)
at nachos.machine.Processor.run(Processor.java:101)
at nachos.userprog.UThread.runProgram(UThread.java:31)
at nachos.userprog.UThread.access$000(UThread.java:11)
at nachos.userprog.UThread$1.run(UThread.java:20)
at nachos.threads.KThread.runThread(KThread.java:162)
at nachos.threads.KThread.access$000(KThread.java:30)
at nachos.threads.KThread$1.run(KThread.java:150)
at nachos.machine.TCB.threadroot(TCB.java:240)
at nachos.machine.TCB.access$100(TCB.java:25)
at nachos.machine.TCB$1.run(TCB.java:93)
++FILESYSCALL VAR8: invoke write as buf address is NULL
++FILESYSCALL VAR8: failed
handleExec()
Lacked permission: (java.lang.RuntimePermission createClassLoader)
java.lang.SecurityException
at nachos.security.NachosSecurityManager.no(NachosSecurityManager. java:167)
at nachos.security.NachosSecurityManager.checkPermission(NachosSec urityManager.java:183)
at java.lang.SecurityManager.checkCreateClassLoader(SecurityManage r.java:606)
at java.lang.ClassLoader.(ClassLoader.java:145)
at sun.reflect.DelegatingClassLoader.(DelegatingClassLoader. java:19)
at sun.reflect.DelegatingClassLoader.(DelegatingClassLoader. java:28)
at sun.reflect.ClassDefiner$1.run(ClassDefiner.java:54)
at java.security.AccessController.doPrivileged(AccessController.ja va:228)
at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:51)
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerat or.java:437)
at java.security.AccessController.doPrivileged(AccessController.ja va:228)
at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGene rator.java:433)
at sun.reflect.MethodAccessorGenerator.generateMethod(MethodAccess orGenerator.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccesso rImpl.java:54)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMetho dAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at java.lang.Class.lookupCachedConstructor(Class.java:2536)
at java.lang.Class.getConstructor(Class.java:305)
at nachos.machine.Lib.constructObject(Lib.java:507)
at nachos.userprog.UserProcess.newUserProcess(UserProcess.java:78)
at nachos.userprog.UserProcess.handleExec(UserProcess.java:884)
at nachos.userprog.UserProcess.handleSyscall(UserProcess.java:1078 )
at nachos.userprog.UserProcess.handleException(UserProcess.java:11 04)
at nachos.userprog.UserKernel.exceptionHandler(UserKernel.java:105 )
at nachos.userprog.UserKernel$1.run(UserKernel.java:42)
at nachos.machine.Processor$MipsException.handle(Processor.java:60 3)
at nachos.machine.Processor.run(Processor.java:101)
at nachos.userprog.UThread.runProgram(UThread.java:31)
at nachos.userprog.UThread.access$000(UThread.java:11)
at nachos.userprog.UThread$1.run(UThread.java:20)
at nachos.threads.KThread.runThread(KThread.java:162)
at nachos.threads.KThread.access$000(KThread.java:30)
at nachos.threads.KThread$1.run(KThread.java:150)
at nachos.machine.TCB.threadroot(TCB.java:240)
at nachos.machine.TCB.access$100(TCB.java:25)
at nachos.machine.TCB$1.run(TCB.java:93)
at java.lang.Thread.run(Thread.java:738)
Not sure for that. Should figure out the life cycle of user program then handle this problem.
++FILESYSCALL Run the 9th variations
++FILESYSCALL VAR9: [STARTED]
++FILESYSCALL VAR9: open mv.c
++FILESYSCALL VAR9: file handle 2
++FILESYSCALL VAR9: file handle 3
++FILESYSCALL VAR9: invoke read/write some times
++FILESYSCALL VAR9: invoke read as buf address is NULL
++FILESYSCALL VAR9: failed
I'ts difficult to write code for this case(ISPRMGR, VAR9).
/* TestID 3: Test ThreadGrader7 (no ticket transfers (priority donation)) */
public static void LotterySchedulerVAR4() { /*@B4A*/
System.out.print("++MyTester: enter LotterySchedulerVAR4\n"); /*@B4A*/
PriopritySchedulerVAR1(); /*@B4A*/
PriopritySchedulerVAR2(); /*@B4A*/
PriopritySchedulerVAR3(); /*@B4A*/
PriopritySchedulerVAR4(); /*@B4A*/
System.out.print("++MyTester: leave LotterySchedulerVAR4\n"); /*@B4A*/
}
[LotteryQueue.pickNextThread] Sum: 2 LotteryValue: 1
[ThreadState.getEffectivePriority] holder thread: Thread listner (#131) Size: 2
[PriorityQueue.acquire] thread: Thread listner (#131) holder: null
####### runNextThread: nextThread = Thread listner
Switching from: Thread speaker (#130) to: Thread listner (#131)
Running thread: Thread listner (#131)
[PriorityQueue.acquire] thread: Thread listner (#131) holder: nachos.threads.LotteryScheduler$ThreadState@31023102
nachos.machine.AssertionFailureError
at nachos.machine.Lib.assertTrue(Lib.java:77)
at nachos.threads.PriorityScheduler$ThreadState.acquire(PriorityScheduler.java:420)
at nachos.threads.PriorityScheduler$PriorityQueue.acquire(PriorityScheduler.java:173)
at nachos.threads.Lock.acquire(Lock.java:53)
at nachos.threads.Condition2.sleep(Condition2.java:48)
at nachos.threads.Communicator.listen(Communicator.java:86)
at nachos.threads.Communicator$Listener.run(Communicator.java:130)
at nachos.threads.KThread.runThread(KThread.java:162)
at nachos.threads.KThread.access$000(KThread.java:30)
at nachos.threads.KThread$1.run(KThread.java:150)
at nachos.machine.TCB.threadroot(TCB.java:240)
at nachos.machine.TCB.access$100(TCB.java:25)
at nachos.machine.TCB$1.run(TCB.java:93)
at java.lang.Thread.run(Thread.java:738)
Please enter your choice:
Bye
I tried to run the java version of Nachos on Windows 7 and Redhat Linux, but both failed due to RuntimePermission problem as below.
user\nachos\proj1> java nachos.machine.Machine nachos.conf
nachos 5.0j initializing... config interrupt timer user-check
Lacked permission: (java.lang.RuntimePermission createClassLoader)
Exception in thread "main" nachos.machine.AssertionFailureError
at nachos.machine.Lib.assertTrue(Lib.java:77)
at nachos.machine.Lib.assertNotReached(Lib.java:96)
at nachos.machine.Lib.checkMethod(Lib.java:565)
at nachos.machine.Machine.checkUserClasses(Machine.java:262)
at nachos.machine.Machine.main(Machine.java:57)
Searching on Google using keywords RuntimePermission and createClassLoader, found some solutions that need to modify the file: $(JAVA HOME)\jre\lib\security\java.policy. So I appended following lines to it.
grant {
permission java.security.AllPermission;
};
However, it still can't work. Can anyone provide any clues on this problem? Thanks.
.......
initializing .text section (3 pages)
initializing .rdata section (1 pages)
initializing .data section (0 pages)
initializing .bss section (2 pages)
[UserProcess.load] args[0]: cp.coff
[UserProcess.load] args[1]: cat.coff
[UserProcess.load] args[2]: cat1.coff
handleWrite()
handle: 1
buf address: 4096
buf size: 46
inside write: 46
[UserProcess.handleOpen] Start
[UserProcess.handleOpen] a0: 33564705
java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 32778
at nachos.userprog.UserProcess.readVirtualMemory(UserProcess.java:188)
at nachos.userprog.UserProcess.readVirtualMemory(UserProcess.java:153)
at nachos.userprog.UserProcess.readVirtualMemoryString(UserProcess.java:134)
at nachos.userprog.UserProcess.handleOpen(UserProcess.java:511)
at nachos.userprog.UserProcess.handleSyscall(UserProcess.java:1046)
at nachos.userprog.UserProcess.handleException(UserProcess.java:1101)
at nachos.userprog.UserKernel.exceptionHandler(UserKernel.java:105)
at nachos.userprog.UserKernel$1.run(UserKernel.java:42)
at nachos.machine.Processor$MipsException.handle(Processor.java:603)
at nachos.machine.Processor.run(Processor.java:101)
at nachos.userprog.UThread.runProgram(UThread.java:31)
at nachos.userprog.UThread.access$000(UThread.java:11)
at nachos.userprog.UThread$1.run(UThread.java:20)
at nachos.threads.KThread.runThread(KThread.java:162)
at nachos.threads.KThread.access$000(KThread.java:30)
at nachos.threads.KThread$1.run(KThread.java:150)
at nachos.machine.TCB.threadroot(TCB.java:240)
at nachos.machine.TCB.access$100(TCB.java:25)
at nachos.machine.TCB$1.run(TCB.java:93)
at java.lang.Thread.run(Thread.java:738)
hello i'm a new to OS. I have been given a task of creating and executing new system call for Nachos OS on windows. I was able to compile user programs under nachos/test . but while running user programs i keep getting the error
"COULD NOT FIND OR LOAD MAIN CLASS nachos.machine.Machine" . I am using Cygwin Emulator for this task. please help me with this issue in a detailed and easy manner
++FILESYSCALL: Start this run
++FILESYSCALL: ARG[1] is 10
++FILESYSCALL VAR10: tests that stdin uses console
++FILESYSCALL VAR10: [STARTED]
++FILESYSCALL VAR10: input a number:
234
++FILESYSCALL VAR10: this number is 50
case 3:
/**********************************************************/
/ /
/ Variation 3: /
/ tests if your syscall open fails gracefully /
/ when stubFileSystem's openfile limit's exceeded /
/ */
/***********************************************************/
LOG("++FILESYSCALL VAR3: [STARTED]\n");
LOG("++FILESYSCALL VAR3: tests if your syscall open fails gracefully when stubFileSystem's openfile limit's exceeded\n");
LOG("++FILESYSCALL VAR3: will open %d files\n", MAXOPENFILES);
for (i = 0; i < MAXOPENFILES + 1; i++) {
LOG("++FILESYSCALL VAR3: opening the %dth file\n", i);
fds[i] = open("out");
if (fds[i] == -1) {
LOG("++FILESYSCALL VAR3: failed to open file \"out\" \n");
exit(-1);
}
}
LOG("++FILESYSCALL VAR3: SUCCESS\n");
break;
Switching from: medium (#16) to: medium (#16)
Running thread: medium (#16)
Medium thread is blocked, please open the door.
Yielding thread: medium (#16)
Ready thread: medium (#16)
***[LotteryQueue]***
Thread: high (#15) Priority: 7
Thread: medium (#16) Priority: 6
*******************
[Lottery Scheduler] Lottery value: 3016 Sum: 4116
####### runNextThread: nextThread = medium
Switching from: medium (#16) to: medium (#16)
Running thread: medium (#16)
Medium thread is blocked, please open the door.
Yielding thread: medium (#16)
Ready thread: medium (#16)
***[LotteryQueue]***
Thread: high (#15) Priority: 7
Thread: medium (#16) Priority: 6
*******************
[Lottery Scheduler] Lottery value: 3568 Sum: 4116
####### runNextThread: nextThread = medium
Switching from: medium (#16) to: medium (#16)
Running thread: medium (#16)
Medium thread is blocked, please open the door.
Yielding thread: medium (#16)
Ready thread: medium (#16)
***[LotteryQueue]***
Thread: high (#15) Priority: 7
Thread: medium (#16) Priority: 6
*******************
[Lottery Scheduler] Lottery value: 1210 Sum: 4116
userproc/UserProcess.java: UserProcess.handleExcetion:
default:
Lib.debug(dbgProcess, "Unexpected exception: " +
Processor.exceptionNames[cause]);
/* Fix defect by isprmgr, Var7 */
handleExit(-1); /*@BCA*/
Lib.assertNotReached("Unexpected exception");
Is it reasonable to invoke 'handleExit' for unhandled exception?
Variation 11: tests testout
stdout doesn't work
Run MyTester.LotterySchedulerVAR3, hit the error:
[ThreadState.getEffectivePriority] holder thread: main (#0) Size: 1
[LotteryQueue.pickNextThread] Thread: main (#0) Priority: 1
java.lang.IllegalArgumentException
at java.util.Random.nextInt(Random.java:236)
at nachos.threads.LotteryScheduler$LotteryQueue.pickNextThread(LotteryScheduler.java:92)
at nachos.threads.PriorityScheduler$PriorityQueue.nextThread(PriorityScheduler.java:196)
at nachos.threads.KThread.runNextThread(KThread.java:351)
at nachos.threads.KThread.sleep(KThread.java:264)
at nachos.threads.KThread.finish(KThread.java:211)
at nachos.threads.KThread.runThread(KThread.java:163)
at nachos.threads.KThread.access$000(KThread.java:30)
at nachos.threads.KThread$1.run(KThread.java:150)
at nachos.machine.TCB.threadroot(TCB.java:240)
at nachos.machine.TCB.access$100(TCB.java:25)
at nachos.machine.TCB$1.run(TCB.java:93)
at java.lang.Thread.run(Thread.java:738)
LotterySchedulerVAR2 failed. There should be something wrong with my implementation of Lottery Scheduling.
Need to investigate this problem.
Hit below error while running ISPRMGR VAR9:
Lacked permission: (java.lang.RuntimePermission createClassLoader)
java.lang.SecurityException
at nachos.security.NachosSecurityManager.no(NachosSecurityManager.java:167)
at nachos.security.NachosSecurityManager.checkPermission(NachosSecurityManager.java:183)
at java.lang.SecurityManager.checkCreateClassLoader(SecurityManager.java:606)
at java.lang.ClassLoader.(ClassLoader.java:145)
at sun.reflect.DelegatingClassLoader.(DelegatingClassLoader.java:19)
at sun.reflect.DelegatingClassLoader.(DelegatingClassLoader.java:28)
at sun.reflect.ClassDefiner$1.run(ClassDefiner.java:54)
at java.security.AccessController.doPrivileged(AccessController.java:228)
at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:51)
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:437)
at java.security.AccessController.doPrivileged(AccessController.java:228)
at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:433)
at sun.reflect.MethodAccessorGenerator.generateMethod(MethodAccessorGenerator.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:54)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at java.lang.Class.lookupCachedConstructor(Class.java:2536)
at java.lang.Class.getConstructor(Class.java:305)
at nachos.machine.Lib.constructObject(Lib.java:507)
at nachos.userprog.UserProcess.newUserProcess(UserProcess.java:78)
at nachos.userprog.UserProcess.handleExec(UserProcess.java:891)
at nachos.userprog.UserProcess.handleSyscall(UserProcess.java:1085)
at nachos.userprog.UserProcess.handleException(UserProcess.java:1111)
at nachos.userprog.UserKernel.exceptionHandler(UserKernel.java:105)
at nachos.userprog.UserKernel$1.run(UserKernel.java:42)
at nachos.machine.Processor$MipsException.handle(Processor.java:603)
at nachos.machine.Processor.run(Processor.java:101)
at nachos.userprog.UThread.runProgram(UThread.java:31)
at nachos.userprog.UThread.access$000(UThread.java:11)
at nachos.userprog.UThread$1.run(UThread.java:20)
at nachos.threads.KThread.runThread(KThread.java:162)
at nachos.threads.KThread.access$000(KThread.java:30)
at nachos.threads.KThread$1.run(KThread.java:150)
at nachos.machine.TCB.threadroot(TCB.java:240)
at nachos.machine.TCB.access$100(TCB.java:25)
at nachos.machine.TCB$1.run(TCB.java:93)
at java.lang.Thread.run(Thread.java:738)
++FILESYSCALL: Start this run
++FILESYSCALL: ARG[1] is 7
++FILESYSCALL VAR7: [STARTED]
++FILESYSCALL VAR7: copies between files, tests creat, open, read, write, close
++FILESYSCALL VAR7: invoke syscall exec cp.coff
++cp: I'm OK now
++cp: arg0 Øÿ½'
++cp: arg+1+ FØIÿL½E'SY
S+C+AcLpL: VaArRg72: ØDÿS½T':
+
++c+pF:I LUEnSaYbSlCeA LtLo VoApRe7n: ØSÿR½C':
FileSyscall.c VAR 7 12138
++FILESYSCALL VAR7: failed to copy file
Same as subject. Need to figure out why.
Lacked permission: (java.lang.RuntimePermission createClassLoader)
java.lang.SecurityException
at nachos.security.NachosSecurityManager.no(NachosSecurityManager.java:167)
at nachos.security.NachosSecurityManager.checkPermission(NachosSecurityManager.java:183)
at java.lang.SecurityManager.checkCreateClassLoader(SecurityManager.java:606)
at java.lang.ClassLoader.(ClassLoader.java:145)
at sun.reflect.DelegatingClassLoader.(DelegatingClassLoader.java:19)
at sun.reflect.DelegatingClassLoader.(DelegatingClassLoader.java:28)
at sun.reflect.ClassDefiner$1.run(ClassDefiner.java:54)
at java.security.AccessController.doPrivileged(AccessController.java:228)
at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:51)
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:437)
at java.security.AccessController.doPrivileged(AccessController.java:228)
at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:433)
at sun.reflect.MethodAccessorGenerator.generateMethod(MethodAccessorGenerator.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:54)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at java.lang.Class.lookupCachedConstructor(Class.java:2536)
at java.lang.Class.getConstructor(Class.java:305)
at nachos.machine.Lib.constructObject(Lib.java:507)
at nachos.userprog.UserProcess.newUserProcess(UserProcess.java:83)
at nachos.userprog.UserProcess.handleExec(UserProcess.java:994)
at nachos.userprog.UserProcess.handleSyscall(UserProcess.java:1188)
at nachos.userprog.UserProcess.handleException(UserProcess.java:1214)
at nachos.userprog.UserKernel.exceptionHandler(UserKernel.java:106)
at nachos.userprog.UserKernel$1.run(UserKernel.java:43)
at nachos.machine.Processor$MipsException.handle(Processor.java:603)
at nachos.machine.Processor.run(Processor.java:101)
at nachos.userprog.UThread.runProgram(UThread.java:31)
at nachos.userprog.UThread.access$000(UThread.java:11)
at nachos.userprog.UThread$1.run(UThread.java:20)
at nachos.threads.KThread.runThread(KThread.java:162)
at nachos.threads.KThread.access$000(KThread.java:30)
at nachos.threads.KThread$1.run(KThread.java:150)
at nachos.machine.TCB.threadroot(TCB.java:240)
at nachos.machine.TCB.access$100(TCB.java:25)
at nachos.machine.TCB$1.run(TCB.java:93)
at java.lang.Thread.run(Thread.java:738)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.