?? project1.htm
字號:
}
</STYLE>
<!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="1054"/></xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]--></HEAD>
<BODY bgColor=#f5f1e5 lang=ZH-CN link=#27745b style="tab-interval: 36.0pt"
vLink=#27745b>
<DIV class=Section1>
<P align=center class=MsoNormal style="TEXT-ALIGN: center"><SPAN lang=EN-US
style="FONT-SIZE: 18pt; mso-bidi-font-size: 12.0pt"><B>Project
1<o:p></o:p></B></SPAN></P>
<P align=center class=MsoNormal style="TEXT-ALIGN: center"><SPAN lang=EN-US
style="FONT-SIZE: 18pt; mso-bidi-font-size: 12.0pt"><B>Systems Programming
Practice: The Yalnix Shell</B></SPAN></P>
<P class=MsoNormal><B style="mso-bidi-font-weight: normal"><SPAN
lang=EN-US>Educational Objectives:<o:p></o:p></SPAN></B></P>
<P class=MsoNormal><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>Students come to this course with various
experiences. For many people this project will be practice and/or a warm-up. For
others, it will be a learning exercise. Regardless of your background, by the
end of this project, we hope that you will comfortably and confidently be able
to do the following:</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 54pt; TEXT-INDENT: -18pt; mso-list: l3 level1 lfo5; tab-stops: list 54.0pt"><![if !supportLists]><SPAN
lang=EN-US
style="FONT-FAMILY: Symbol; mso-fareast-font-family: 'Times New Roman'">·<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN lang=EN-US>Develop clear, readable,
well-documented and well-designed programs in the C Programming
Language.</SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 54pt; TEXT-INDENT: -18pt; mso-list: l3 level1 lfo5; tab-stops: list 54.0pt"><![if !supportLists]><SPAN
class=HTMLTypewriter><SPAN lang=EN-US
style="FONT-FAMILY: Symbol; mso-fareast-font-family: 'Times New Roman'; mso-ansi-font-size: 12.0pt; mso-bidi-font-family: 'Times New Roman'">·<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN></SPAN><![endif]><SPAN class=HTMLTypewriter><SPAN lang=EN-US
style="mso-ansi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Develop
software in the Unix/Linux using tools such as gcc, gdb, and
make.</SPAN></SPAN><SPAN class=HTMLTypewriter><SPAN lang=EN-US
style="mso-fareast-font-family: 'Times New Roman'; mso-ansi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 54pt; TEXT-INDENT: -18pt; mso-list: l3 level1 lfo5; tab-stops: list 54.0pt"><![if !supportLists]><SPAN
lang=EN-US
style="FONT-FAMILY: Symbol; mso-fareast-font-family: 'Times New Roman'">·<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN class=HTMLTypewriter><SPAN lang=EN-US
style="mso-ansi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Locate
and </SPAN></SPAN><SPAN lang=EN-US>interpreting “man pages” applicable to
application-level system programming. </SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 54pt; TEXT-INDENT: -18pt; mso-list: l3 level1 lfo5; tab-stops: list 54.0pt"><![if !supportLists]><SPAN
lang=EN-US
style="FONT-FAMILY: Symbol; mso-fareast-font-family: 'Times New Roman'">·<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN lang=EN-US>Use the POSIX/Unix API to system
functions to manage process and sessions as well as use signals and pipes for
inter-process communication. </SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 54pt; TEXT-INDENT: -18pt; mso-list: l3 level1 lfo5; tab-stops: list 54.0pt"><![if !supportLists]><SPAN
lang=EN-US
style="FONT-FAMILY: Symbol; mso-fareast-font-family: 'Times New Roman'">·<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN lang=EN-US>Understanding how synchronization might
become problematic in light of concurrency. </SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 54pt; TEXT-INDENT: -18pt; mso-list: l3 level1 lfo5; tab-stops: list 54.0pt"><![if !supportLists]><SPAN
lang=EN-US
style="FONT-FAMILY: Symbol; mso-fareast-font-family: 'Times New Roman'">·<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN lang=EN-US>Understand how to communicate and
cooperate with a project partner.</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P><SPAN
lang=EN-US
style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 12pt; mso-fareast-font-family: 宋體; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"><BR
clear=all style="PAGE-BREAK-BEFORE: always"></SPAN>
<P class=MsoNormal><A name=tth_sEc1></A><B
style="mso-bidi-font-weight: normal"><SPAN lang=EN-US>Project
Overview<o:p></o:p></SPAN></B></P>
<P class=MsoNormal><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>In this project you are asked to implement a
simple command-interpreter, a.k.a. “shell,” for Linux. The shell that you will
implement, known as ysh, should be similar to popular shells such as bash, csh,
tcsh, zsh, &c, but it is not required to implement as many features as these
commercial-grade products. </SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>Although we don’t require all of the “bells
and whistles” that are incorporated into commercial-grade products, ysh should
have much of the important functionality:</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<UL style="MARGIN-TOP: 0cm" type=disc>
<LI class=MsoNormal
style="mso-list: l1 level1 lfo8; tab-stops: list 36.0pt"><SPAN
lang=EN-US>Allow the user to execute one or more programs, from executable
files on the file-system, as background or foreground jobs.</SPAN>
<LI class=MsoNormal
style="mso-list: l1 level1 lfo8; tab-stops: list 36.0pt"><SPAN
lang=EN-US>Provide job-control, including a job list and tools for changing
the foreground/background status of currently running jobs and job
suspension/continuation/termination.</SPAN>
<LI class=MsoNormal
style="mso-list: l1 level1 lfo8; tab-stops: list 36.0pt"><SPAN
lang=EN-US>Allow for the piping of several tasks as well as input and output
redirection. </SPAN></LI></UL>
<P class=MsoNormal><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>With respect to the other programming
assignments this semester, and many others in your experience, this is likely to
be a small project, but we want you to approach it as if it is a bigger and more
complex project so that you are prepared for the remaining projects.
Specifically, we’d like you to do the following:</SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 54pt; TEXT-INDENT: -18pt; mso-list: l3 level1 lfo5; tab-stops: list 54.0pt"><![if !supportLists]><SPAN
lang=EN-US
style="FONT-FAMILY: Symbol; mso-fareast-font-family: 'Times New Roman'">·<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN lang=EN-US>Use the make utility to build your
project </SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 54pt; TEXT-INDENT: -18pt; mso-list: l3 level1 lfo5; tab-stops: list 54.0pt"><![if !supportLists]><SPAN
lang=EN-US
style="FONT-FAMILY: Symbol; mso-fareast-font-family: 'Times New Roman'">·<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN lang=EN-US>Use a debugger instead of
print-and-hunt debugging whenever practical. </SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 54pt; TEXT-INDENT: -18pt; mso-list: l3 level1 lfo5; tab-stops: list 54.0pt"><![if !supportLists]><SPAN
lang=EN-US
style="FONT-FAMILY: Symbol; mso-fareast-font-family: 'Times New Roman'">·<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN lang=EN-US>Produce clean, well-documented, and
well-designed solutions. <A name=tth_sEc2></A><A name=tth_sEc3></A></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<H1><SPAN lang=EN-US>Specification</SPAN></H1>
<P class=MsoNormal><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><A name=ysh></A><B
style="mso-bidi-font-weight: normal"><SPAN
lang=EN-US>Form<o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><B
style="mso-bidi-font-weight: normal"><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></B></P>
<P class=MsoBodyTextIndent><SPAN lang=EN-US>Your solution should be an
application program invoked without command-line parameters or configuration
files, &c. If you want to be fancy and support for a resource file similar
to those used with commercial-grade shells, e.g. .cshrc, you’re a welcome to do
this. But, like csh, your shell should function correctly in absence of this
file.<SPAN style="mso-spacerun: yes"> </SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><B
style="mso-bidi-font-weight: normal"><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><B
style="mso-bidi-font-weight: normal"><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><B
style="mso-bidi-font-weight: normal"><SPAN
lang=EN-US>Look-and-Feel<o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US>The look and feel
of ysh should be similar to that of other UNIX shells, such as bash, tcsh, csh,
&c. For example, your shell’s work loop should produce a prompt, e.g.,
ysh>, accept input from the user, and then produce another prompt. Messages
should be written to the screen as necessary, and the prompt should be delayed
when user input shouldn’t be accepted, as necessary. Needless to say, your shell
should take appropriate action in response to the user’s input. </SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<H4><SPAN lang=EN-US>Internal Commands vs. External Programs</SPAN></H4>
<H4><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></H4>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US>In most cases, the
user’s input will be a command to execute programs stored within a file system.
We’ll call these <I style="mso-bidi-font-style: normal">external programs.
</I>Your shell should allow these programs to execute with stdin and/or stdout
reassigned to a file. It should allow programs I/O to be chained together using
pipes. For our purposes, a collection of piped processes or a single process
executed by itself<SPAN style="mso-spacerun: yes"> </SPAN>from the command
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -