Skip to content

Commit b3b8719

Browse files
Add files via upload
Пример кода.
1 parent b32ba71 commit b3b8719

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

main.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from kernel.kernel import *
2+
3+
proc_code1 = '''
4+
print(f"USER: Started with PID {pid}")
5+
6+
request = {
7+
"cmd": "write",
8+
"path": "/home/log.txt",
9+
"data": "в 14:35 напомни!!!",
10+
"client_pid": pid,
11+
"reply_pipe": 1
12+
}
13+
request2 = {
14+
"cmd": "cat",
15+
"path": "/home/log.txt",
16+
"client_pid": pid,
17+
"reply_pipe": 1
18+
}
19+
20+
print(f"USER: Writing and reading /home/log.txt via pipe 0...")
21+
22+
await send(0, request, pid)
23+
await recv(1, pid)
24+
25+
await send(0, request2, pid)
26+
data = await recv(1, pid)
27+
28+
print(f"USER: Result from FS: {data}")
29+
'''
30+
31+
if __name__ == "__main__":
32+
create_proc(proc_code1, 1)
33+
boot()
34+
asyncio.run(scheduler())

0 commit comments

Comments
 (0)