Title: Ceng 313 Operating Systems Lab
1Dept. of Computer Engineering Ceng 313 Operating
Systems Lab. 2003-2004 Fall Windows NT/2000 Dr.
A. Koltuksuz ltahmetkoltuksuz_at_iyte.edu.trgt
2Agenda
- Briefly Iztech
- Dept. of Computer Engineering
- Undergrad Education
- Ceng 313 Operating Systems
- Ceng 313 Operating Systems Lab.
- Rationale References NT Objectives
- 2003-2004 Fall Experiences
- Example Manipulating Kernel Objects
- Documentation and Presentation
- Evaluation
- Further Info
3Briefly Iztech
- Established in 1992.
- Located in Gülbahçe Urla, Izmir, TURKEY.
- Aims education for high technology supported by
research and cooperation with private sector. - 3 Colleges with an Institute of Graduate Studies.
- Computer Research and Application Center.
- Department of Foreign Languages (Prep school).
4Location
5Dept. of Computer Engineering
6Research Areas of Comp. Engineering
- Information Systems Strategy and Security
- Cryptography and Cryptanalysis
- Information Warfare
- Network Security
- Intrusion Detection
- Data Mining
- Research Planning and Evaluation
- Real Time Embedded Systems
- Software Engineering
7Undergrad
8Undergrad Core Courses
- Data Structures, Programming Languages
- Logic Design, Computer Architecture
- Operating Systems
- Database Management Systems
- Software Engineering, Project Management
- Stochastic Processes, Information Theory
9Ceng 313 Operating Systems
- Its a must course.
- 3 credit hours lecturing,
- Plus 2 credit hours of a lab.
- Taken by the juniors in fall term.
10Ceng 313 Operating Systems
- Objectives
- Of the all students of computer engineering,
only a few will end up in designing and
implementing an operating system. - A larger number will be in charge of some
modifications. - But, virtually all will use the facilities and
utilities provided by operating systems. - Those students will surely benefit from knowing
the issues of operating systems design and
implementation.
11Ceng 313 Operating Systems
Reference books Silberschatz Abraham and Peter
B. Galvin. Operating System Concepts, 4th ed.,
Reading, MAAddison-Wesley, 1994. Nutt Garry.
Operating Systems,A Modern Perspective, 2nd ed.,
Reading, MAAddison-Wesley, 2000.
12Ceng 313 Operating Systems Lab.
- Rationale
- No way of appreciating the merits of the theory
of operating systems WITHOUT actual coding. - Hands on experience required!
- Start playing with the real kernels.
- Hence the OS LAB and Windows NT!
13Ceng 313 Operating Systems Lab.
Reference books Nutt Garry. Operating System
Projects, Using Windows NT, Reading,
MAAddison-Wesley, 1999. Solomon A. David and
Mark E. Russinovich, Inside Microsoft Windows
2000, 3rd ed., Washington, Microsoft Press, 2000.
14Ceng 313 Operating Systems Lab.
- Objectives
- Learn the specific Windows NT mechanisms for the
system-software operation and understand the
design and implementation issues behind them.
15Ceng 313 Operating Systems Lab.
- Realization
- The below topics covered in the fall term of
2003-2004 - Lab 1 Managing Multiple Tasks
- Lab 2 Writing Multithreaded S/W
- Lab 3 Manipulating Kernel Objects
- Lab 4 Thread Synchronization
- Lab 5 Interprocess Communication
- Lab 6 Virtual Memory
- Lab 7 Memory-Mapped Files
- Lab 8 Floppy Disk I/O
an info sheet plus a powerpoint presentation were
provided for each lab session.
16Ceng 313 Operating Systems Lab.
- Info Sheet
- Consists of the
- 1. Objectives,
- 2. Materials Required,
- 3. Activities and of
- 4. Reporting.
17Ceng 313 Operating Systems Lab.
Example Info Sheet Lab 3 Manipulating Kernel
Objects 1. Objectives Windows NT operating system
mechanisms are implemented as objects at the
kernel and the Executive levels. Processes and
threads are represented with the process and
thread objects. Processes and threads are used to
create other kernel objects as well. Examples of
the other kernel objects are event, mutex,
semaphore, symbolic link, waitable timer etc. . .
. . . . . . . After completing this lab, you will
be able to ? Understand kernel objects and
handles ? Understand the model for managing
objects ? Use Waitable timers.
18Ceng 313 Operating Systems Lab.
Example Info Sheet Lab 3 Manipulating Kernel
Objects 2. Materials Required This lab will
require the following ? Windows NT/2000
operating system ? MS Visual C 6.0 IDE ?
Administrator access to the machine.
19Ceng 313 Operating Systems Lab.
Example Info Sheet Lab 3 Manipulating Kernel
Objects 3. Activities Note Since waitable timers
are not implemented in versions of NT earlier
than 4.0 and they are not in Windows 9x or CE, a
compiler flag should be included to recognize
waitable timer related API functions. The
compiler flag is set in one of two ways 1. Add
a new line to the source code define
_WIN32_WINNT 0x0400 2. In the Visual C 6.0
environment, go to Project/Settings dialog,
select C/C tab and add /D _WIN32_WINNT
0x0400 to the Project Options box (Figure 5).
20Ceng 313 Operating Systems Lab.
Example Info Sheet Lab 3 Manipulating Kernel
Objects 3 .Activities
Figure 5 Settings for recognizing the Timer
functions.
21Ceng 313 Operating Systems Lab.
Example Info Sheet Lab 3 Manipulating Kernel
Objects 3. Activities Activities are defined in
the problem statement of the exercise in Part II
Chapter 3 of the book Operating System Projects
Using Windows NT by Gary Nutt. 4. Report Due
in one week, refer to the above referenced
problem statement.
Example ppt presentation Lab 3 Manipulating
Kernel Objects
Please click
22Lab 3-Manipulating Kernel Objects
23Kernel Objects-1
- allocated in privileged space
- includes an object header and an object body
- object header
- name
- security descriptor
- handle count
- reference count
- type
- object body is specific to the object type
24Kernel Objects-2
- created by processes
- referenced by processes or executive objects
- a process references a kernel object provided
that the process knows the name of the object and
has security access to the object. - an executive component references the object by
its address
25Kernel Objects-3
- after referenced by a process, the kernel object
increments the handle count and reference count - after referenced by an executive component, the
kernel object increments the reference count
26Handles
- a process is given a handle after creating or
referencing a kernel object - handle information is stored as part of process
description and stored in privileged space - handle is just an index to the handle table in
the process description
27Handle Descriptors
28Some Kernel Objects
- process
- thread
- event
- symbolic link
- semaphore
- mutex
- timer
- ...
29CreateWaitableTimer
HANDLE CreateWaitableTimer( LPSECURITY_ATTRIBUTES
lpTimerAttributes, // pointer to security
attributes BOOL bManualReset, // flag for
manual reset state LPCTSTR lpTimerName //
pointer to timer object name )
30OpenWaitableTimer
- HANDLE OpenWaitableTimer(
- DWORD dwDesiredAccess, // access flag
- BOOL bInheritHandle, // inherit flag
- LPCTSTR lpTimerName
- // pointer to timer object name
- )
31SetWaitableTimer
- BOOL SetWaitableTimer(
- HANDLE hTimer, // handle to a timer object
- const LARGE_INTEGER pDueTime,
- // when timer will become signaled
- LONG lPeriod, // periodic timer interval
- PTIMERAPCROUTINE pfnCompletionRoutine,
- // completion routine
- LPVOID lpArgToCompletionRoutine,
- // data for completion routine
- BOOL fResume // flag for resume state
- )
32WaitForSingleObject
- DWORD WaitForSingleObject(
- HANDLE hHandle, // handle to object to wait for
- DWORD dwMilliseconds // time-out interval in
milliseconds - )
33Setting Program Arguments
34Adding Compiler Flag
35Ceng 313 Operating Systems Lab.
Evaluation Each lab is evaluated separately and
the average is calculated. The distribution of
weights on which the final grade obtained is as
follows
36Ceng 313 Operating Systems Lab.
From the final exam... Q.5 (15 points) A
multithreaded program should execute for a user
specified run time. Please recommend two
mechanisms to end the program when the specified
time is over. Attention Sleep(runTime) does not
count as a solution. Win32 API specific examples
are ok.
37Ceng 313 Operating Systems Lab.
38Ceng 313 Operating Systems Lab.
Further Info All of the here mentioned lab info
documents plus powerpoint presentations can be
reached at http//www.msakademik.net
39Ceng 313 Operating Systems Lab.
40Ceng 313 Operating Systems Lab.
Thank you very much for your attention.