400 likes | 703 Views
Dept. of Computer Engineering Ceng 313 Operating Systems Lab. 2003-2004 Fall Windows NT/2000 Dr. A. Koltuksuz <ahmetkoltuksuz@iyte.edu.tr>. Agenda. Briefly Iztech Dept. of Computer Engineering Undergrad Education Ceng 313 Operating Systems Ceng 313 Operating Systems Lab.
E N D
Dept. of Computer Engineering Ceng 313 Operating Systems Lab. 2003-2004 Fall Windows NT/2000 Dr. A. Koltuksuz <ahmetkoltuksuz@iyte.edu.tr>
Agenda • 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
Briefly İztech • Established in 1992. • Located in Gülbahçe – Urla, İzmir, 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).
Research 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
Undergrad Core Courses • Data Structures, Programming Languages • Logic Design, Computer Architecture • Operating Systems • Database Management Systems • Software Engineering, Project Management • Stochastic Processes, Information Theory
Ceng 313 Operating Systems • It’s a must course. • 3 credit hours lecturing, • Plus 2 credit hours of a lab. • Taken by the juniors in fall term.
Ceng 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.
Ceng 313 Operating Systems Reference books: Silberschatz Abraham and Peter B. Galvin. Operating System Concepts, 4th ed., Reading, MA:Addison-Wesley, 1994. Nutt Garry. Operating Systems,A Modern Perspective, 2nd ed., Reading, MA:Addison-Wesley, 2000.
Ceng 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!
Ceng 313 Operating Systems Lab. Reference books: Nutt Garry. Operating System Projects, Using Windows NT, Reading, MA:Addison-Wesley, 1999. Solomon A. David and Mark E. Russinovich, Inside Microsoft Windows 2000, 3rd ed., Washington, Microsoft Press, 2000.
Ceng 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.
Ceng 313 Operating Systems Lab. • Realization: • The below topics covered in the fall term of 2003-2004: • Lab #1 Managing Multiple Tasks • Lab #2Writing 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.
Ceng 313 Operating Systems Lab. • Info Sheet • Consists of the • 1. Objectives, • 2. Materials Required, • 3. Activities and of • 4. Reporting.
Ceng 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.
Ceng 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.
Ceng 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).
Ceng 313 Operating Systems Lab. • Example Info Sheet: Lab #3 Manipulating Kernel Objects • 3 .Activities Figure 5 Settings for recognizing the Timer functions.
Ceng 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
Lab 3-Manipulating Kernel Objects CENG 313 OS Lab A. Koltuksuz, S. Atay, S. Tekir 2004
Kernel 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 A. Koltuksuz, S. Atay, S. Tekir 2004
Kernel 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 A. Koltuksuz, S. Atay, S. Tekir 2004
Kernel 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 A. Koltuksuz, S. Atay, S. Tekir 2004
Handles • 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 A. Koltuksuz, S. Atay, S. Tekir 2004
handle kernel object process handle table Handle Descriptors A. Koltuksuz, S. Atay, S. Tekir 2004
Some Kernel Objects • process • thread • event • symbolic link • semaphore • mutex • timer • ... A. Koltuksuz, S. Atay, S. Tekir 2004
CreateWaitableTimer HANDLE CreateWaitableTimer( LPSECURITY_ATTRIBUTES lpTimerAttributes, // pointer to security attributes BOOL bManualReset, // flag for manual resetstate LPCTSTR lpTimerName // pointer to timer object name ); A. Koltuksuz, S. Atay, S. Tekir 2004
OpenWaitableTimer HANDLE OpenWaitableTimer( DWORD dwDesiredAccess, // access flag BOOL bInheritHandle, // inherit flag LPCTSTR lpTimerName // pointer to timer object name ); A. Koltuksuz, S. Atay, S. Tekir 2004
SetWaitableTimer 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 ); A. Koltuksuz, S. Atay, S. Tekir 2004
WaitForSingleObject DWORD WaitForSingleObject( HANDLE hHandle, // handle to object to wait for DWORD dwMilliseconds // time-out interval in milliseconds ); A. Koltuksuz, S. Atay, S. Tekir 2004
Setting Program Arguments A. Koltuksuz, S. Atay, S. Tekir 2004
Adding Compiler Flag A. Koltuksuz, S. Atay, S. Tekir 2004
Ceng 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:
Ceng 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.
Ceng 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
Ceng 313 Operating Systems Lab. Thank you very much for your attention.