操作系统实验的一报告材料材料

上传人:仙*** 文档编号:88045679 上传时间:2022-05-10 格式:DOC 页数:17 大小:312.50KB
收藏 版权申诉 举报 下载
操作系统实验的一报告材料材料_第1页
第1页 / 共17页
操作系统实验的一报告材料材料_第2页
第2页 / 共17页
操作系统实验的一报告材料材料_第3页
第3页 / 共17页
资源描述:

《操作系统实验的一报告材料材料》由会员分享,可在线阅读,更多相关《操作系统实验的一报告材料材料(17页珍藏版)》请在装配图网上搜索。

1、实验目的 :了解和操作线程和进程的概念 ,熟悉 linux 下的命令,熟悉 vi 编辑, gcc 编译, gdb 调试实验思想 : 线程与进程实现结果:1.cat : 把档案串连接后传到基本输出(萤幕或加 fileName 到另一个档案)cd dirName 变换工作目录至 dirName 。 其中 dirName 表示法可为绝对路径或 相对路径。若目录名称省略,则变换至使用者的 home directory ( 也就是刚 login 时所 在的目录 )。chmod Linux/Unix 的档案调用权限分为三级 : 档案拥有者、群组、其他。利用 chmod 可以藉以控制档案如何被他人所调用。c

2、p 将一个档案拷贝至另一档案,或将数个档案拷贝至另一目录cut cut -cnum1-num2 filename显示每行从开头算起 num1 到 num2 的文字find 将档案系统内符合 expression 的档案列出来ln 硬连结的意思是一个档案可以有多个名称,而软连结的方式则是产生一个特殊的档案,该档案的内容是指向另一个档案的位置ls 显示指定工作目录下之内容(列出目前工作目录所含之档案及子目录)。more 一页一页地显示更多内容mv 将一个档案移至另一档案,或将数个档案移至另一目录。rm 删除档案及目录rmdir 删除空的目录touch 指令改变档案的时间记录at linux at

3、命令允许相当复杂的时间指定cal l 日历命令,可以显示当月日历、当年日历、指定月份年份的日历等。date 能够在 shell 上直接显示当前时间,根据选项参数可以根据指定格式输出。passwd 用来更改使用者的密码who 查看当前登录用户的情况mail 收发邮件命令talk 与其他使用者对谈wall 会将讯息传给每一个 mesg 设定为 yes 的上线使用者。write 传讯息给其他使用者kill 关闭进程2.UIDPID PPID CSZRSS PSR STIME TTYzx1521 1019786 9012 1 22:21TIME CMD00:00:0000:00:00ps 显示瞬间行程

4、 (process) 的动态/usr/lib/evolution/evolution-data-server-2.28-oaf-activate-iid=OAFIID:GNOME_Evolution_DataSzx 2562 1 0 6084 2748 0 22:51zx25802556066087028122:51?00:00:00gnome-sessionzx26112580041143032022:51?00:00:02/usr/bin/ibus-daemon -ximzx261525800821360022:51?00:00:00/usr/bin/ssh-agent /usr/bin/

5、dbus-launch -exit-with-session gnome-sessionzx261884676422:5100:00:00/usr/bin/dbus-launch -exit-with-session gnome-sessionzx2619830 152022:5100:00:00/bin/dbus-daemon -fork -print-pid 5 -print-address 7 -sessionzx2620 26110 2263334822:5100:00:00/usr/lib/ibus/ibus-gconfzx2622 2611 014567 2810422:5100:

6、00:06 python/usr/share/ibus/ui/gtk/main.pyzx26244377613622:5100:00:00/usr/lib/ibus/ibus-x11 -kill-daemonzx26272013445622:5100:00:00/usr/lib/libgconf2-4/gconfd-2zx2629 261164501072822:5100:00:01/usr/lib/ibus-pinyin/ibus-engine-pinyin -ibuszx2640166523480 22:5100:00:00/usr/lib/gvfs/gvfsdzx264625805185

7、81320 22:5100:00:00gnome-power-managerzx2647 25800 12438124961 22:5100:00:00 nm-applet-sm-disablezx2649 25800 12281 177760 22:51 ?00:00:00 gnome-panelzx26511 0 7570264022:5100:00:00/usr/lib/gvfs/gvfs-fuse-daemon /home/zx/.gvfszx2653 25801 202112559222:5100:00:11/usr/bin/compizzx2656 2580 0 28032 406

8、120 22:51 ?00:00:06 nautiluszx26581 0 23908474822:5100:00:05/usr/bin/pulseaudio -start -log-target=syslogzx2660 2580 0 5014795622:5100:00:00bluetooth-appletzx26612580 0 4759632822:5100:00:00/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1zx2680 2658 0 2688 299222:5100:00:00/usr/lib/pul

9、seaudio/pulse/gconf-helperzx 2684 1 0 955 10720.5 -kzx26861 0 8227/usr/lib/gvfs/gvfs-gdu-volume-monitorzx26881 0 10579/usr/lib/bonobo-activation/bonobo-activation-server0 22:51 ? 00:00:00 syndaemon -i3904022:51?00:00:003668022:51?00:00:00-ac-activate-ior-output-fd=19zx2702 1 0 11332 15472 1 22:5100:

10、00:02/usr/lib/gnome-panel/wnck-applet-oaf-activate-iid=OAFIID:GNOME_Wncklet_Factory -oaf-ior-fdzx2703 1 0 1834 2392 0 22:5100:00:00/usr/lib/gvfs/gvfs-gphoto2-volume-monitorzx2704 1 0 9570 11648 1 22:5100:00:00/usr/lib/gnome-applets/trashapplet-oaf-activate-iid=OAFIID:GNOME_Panel_TrashApplet_Factoryz

11、x27061 0 4290/usr/lib/gvfs/gvfs-afc-volume-monitorzx27121 0 135492348022:51?00:00:0014364022:51?00:00:00/usr/lib/indicator-applet/indicator-applet-session-oaf-activate-iid=OAFIID:GNOME_FastUserSw-oaf-activate-iid=OAFIID:GNOME_ClockApplet_Factory -oaf-izx2716 1 0 14291 13448 0 22:5100:00:00/usr/lib/i

12、ndicator-applet/indicator-applet-oaf-activate-iid=OAFIID:GNOME_IndicatorApplet_Fazx2717 1 0 5948 9324 0 22:5100:00:00/usr/lib/gnome-panel/notification-area-applet-oaf-activate-iid=OAFIID:GNOME_NotificationArezx27311045764532122:51?00:00:00/usr/lib/indicator-messages/indicator-messages-servicezx27321

13、016302024122:51?00:00:00/usr/lib/gvfs/gvfsd-metadatazx273410213324576022:51?00:00:00/usr/lib/indicator-sound/indicator-sound-servicezx27361060764312122:51?00:00:00/usr/lib/indicator-application/indicator-application-servicezx2737 2653 0 4585121 22:5100:00:00 /bin/sh -c/usr/bin/compiz-decoratorzx2738

14、 27370665911804022:51?00:00:00/usr/bin/gtk-window-decoratorzx2744 1048014952122:51?00:00:00/usr/lib/indicator-me/indicator-me-servicezx2746 1045814860022:51?00:00:00/usr/lib/indicator-session/indicator-session-servicezx2757 1 0 1686 2452 0 22:5100:00:00/usr/lib/gvfs/gvfsd-burn -spawner :1.8 /org/gtk

15、/gvfs/exec_spaw/1zx27731045822740022:52?00:00:00gnome-screensaverzx2783101032512832122:52?00:00:00/usr/lib/notify-osd/notify-osdzx28672580049157620122:52?00:00:00/usr/lib/gnome-disk-utility/gdu-notification-daemon00:00:00 pythonzx 2882 2580 0 8026 15624 1 22:52/usr/share/system-config-printer/applet

16、.pyzx 2883 2580 0 17280/usr/lib/evolution/2.28/evolution-alarm-notifyzx 2889 1 0 19777118600 22:52?00:00:0090000 22:52?00:00:00/usr/lib/evolution/evolution-data-server-2.28-oaf-activate-iid=OAFIID:GNOME_Evolution_DataSzx2893 1 0 9080 11536 0 22:5200:00:00/usr/lib/evolution/2.28/evolution-exchange-st

17、orage -oaf-activate-iid=OAFIID:GNOME_Evolution_zx29111 0 14425164321 22:52 ?00:00:02gnome-terminalzx29122911 0 4977121 22:52 ?00:00:00gnome-pty-helperzx2913 29110160035441 22:52 pts/000:00:00 bashzx2934258001039713032022:52?00:00:00update-notifierzx30181038423020022:54?00:00:00/usr/lib/gvfs/gvfsd-co

18、mputer -spawner :1.8 /org/gtk/gvfs/exec_spaw/2zx 3104 1 0 29947 49336 0 22:59 ? 00:00:02 evince/home/zx/ 桌面 / 到 操作系统 的链接 /ass1.pdfzx 310610 1172 2024022:59?00:00:00/usr/lib/evince/evincedzx 327411 60787 91996023:00?00:00:08/usr/lib/openoffice/program/soffice.bin -writer /home/zx/桌面/到操作系统的链接 /实验一指导 .

19、dzx 3312 10458 560 123:02?00:00:00/bin/sh/usr/lib/firefox-3.6.8/firefoxzx 3317 33120458 568 123:02?00:00:00/bin/shzx3321 3317564232696721 23:02?00:00:18/usr/lib/firefox-3.6.8/firefox-binzx3341 3321023776219961 23:02?00:00:01/usr/lib/flashplugin-installer/libflashplayer.so 3321zx338029570117316720 23

20、:03 pts/000:00:00 su zxzx338933800159935440 23:03 pts/000:00:00 bashzx343334140117617241 23:03 pts/000:00:00 su zxzx344134330159935480 23:03 pts/000:00:00 bashzx34753441067911000 23:07 pts/000:00:00 ps -w -F -u zx3./ 实现交换 a, b 的数值#includeint main()int a,b,c;a = 1;b = 2;printf(a=%dn,a);printf(b=%dn,b

21、);c = a;a = b;b = c;printf(after exchangedn);printf(a=%dn,a);printf(b=%dn,b);return 0;gdb 调试内容:(gdb) runStarting program: /home/zx/p1Breakpoint 1, main () at p1.c:66 a = 1;(gdb) runThe program being debugged has been started already.Start it from the beginning? (y or n) nProgram not restarted.(gdb)

22、next7 b = 2;(gdb) next8 printf(a=%dn,a);(gdb) nexta=19 printf(b=%dn,b);4编写一个控制台应用程序,命名为an_ch2_1b 。这个程序不断地输出如下行:Those output come from child,系统时间 另外写一个控制台应用程序,命名为an_ch2_1a 。这个程序创建一个子进程,执行 an_ch2_1b 。这个程序不断地输出如下行:Those output come from child,系统时间 观察程序运行的结果,并对你看到的现象进行解释。程序代码如下:/an_ch2_1a.c/ 调用子进程运行 an_

23、ch2_1b#include #include #include int main() int pid;if(pid = fork() = 0) system(./an_ch2_1b.out);return 0;/an_ch2_1b.c/ 输出系统时间#include#include #include #include int main()time_t now;struct tm *timenow;while(1)time(&now);time now = localtime(&no w);printf(Those output come from child, %sn,asctime(tim

24、enow);return 0;*0$ zxubuMu:文件(T编誉肴何弊制门幣前(H)ThoseoutputcumeI unichild.TueNuv221:46:432010Thoseoutputcomefroiicnild.lueNOV221-4G:432mThoeoutputcomefromcnilti.TueNOV221:46:432&10Thoseoutputcomef rimchild.TueNov231:46:433010Thoseoutputcomef ramchilcf.TueNov221;46:43201DThoseoutputcomefromchild.TueNov22l

25、:4&;432010Thoseoutputcomefromchild,TueNOV22U40:432B19Thoseoutputcomefromchild*TueNOV221:46:432013Thoseoutputcometramchild.TueNov771:46:432010Thoseoutputcamefromchild,TueNov221:46:432010Thoseoutputcomefromchild.TueNov221:46:432010ThoieGUut|1现象解释:a执行b,b不断输出时间.5 .在linux环境下编写一个控制台应用程序,程序中有一个共享的整型变量share

26、d_var,初始值为0 ;创建一个线程并使其立即与主线程并发执行。新创建的线程与主线程均不断地循环,并输出 shared_var 的值。主线程在循环中不断地对 shared_var 进行加 1 操 作,即每次循环 shared_var 被加 1 ;而新创建的线程则不断地对shared_var 进行减1 操作,即每次循环 shared_var 被减 1 。观察程序运行的结果,并对你看到的现象进 行解释。#include #include #include pthread_t ntid;int shared_var=0;void mainloop()while(1)printf(%dn,share

27、d_var+);void *tloop(void *arg)while(1)printf(%dn,shared_var-);int main( void) if (pthread_create(&n tid, NULL, tloop, NULL) != 0)prin tf(ca nt create thread: %sn ”);mai nloop();return 0;DOG zxubuntu: 编霜(Ei查書(V)线诱(T)厲助出-17685-17684-17683-17682-17681-1768017679-17678-17677-17676-18603、18662-1S6G1-16600-1055918598185971053P10680-18GG9-1069Q-18691输出数值不断波动,有时正有时负。这是在一小片时间内,CPU轮流被子进程和主进程交替占用,所以share_var会出现一时增加一时减少的现象。

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!