Download Lecture 2 on Windows CE files and processes

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

File locking wikipedia , lookup

Computer file wikipedia , lookup

Versant Object Database wikipedia , lookup

Object storage wikipedia , lookup

Monitor (synchronization) wikipedia , lookup

Asynchronous I/O wikipedia , lookup

Transcript
Operating systems
Windows CE files.
Windows CE databases.
Windows CE processes.
© 2004 Wayne Wolf
Overheads for Computers as
Components
WinCE file system
Designed for devices without rotating
storage.
May use disk drives.
Based upon object store.
Object store is undocumented---can’t
determine format in memory.
API is fairly complete version of Win32 file
system.
© 2004 Wayne Wolf
Overheads for Computers as
Components
Object store
Default file system in WinCE.
Stores files in compressed form.
Applications cannot easily distinguish
between RAM and ROM files.
Limited to 256 MB of RAM.
Individual file limited to 32 MB.
© 2004 Wayne Wolf
Overheads for Computers as
Components
Other WinCE file systems
Installable file system (IFS): up to 256 storage
devices with file systems.
Every storage device is a directory from root.
Doesn’t use drive letters C: etc.
Doesn’t have size limitations of object store.
Uses Windows-style file names.
Supports many attribute flags: read-only,
system, hidden, etc.
© 2004 Wayne Wolf
Overheads for Computers as
Components
Memory-mapped files
Can use memory reads/writes to read and
write file.
Don’t need FileRead(), FileWrite().
Opened with specialized calls
CreateFileForMapping(),
CreateFileMapping().
© 2004 Wayne Wolf
Overheads for Computers as
Components
WinCE registry
Database that stores data on configuration of
WinCE and applications.
Used to store data that needs to be saved.
Contains keys, values.
Multiple levels of keys separated by ‘\’.
Registry access:
Key containing value is opened.
Value read or written.
Key is closed.
© 2004 Wayne Wolf
Overheads for Computers as
Components
WinCE databases
Designed for address lists, etc.
Provides basic database functions:
One level.
At most four sort indexes.
Not supported by other Windows
platforms.
© 2004 Wayne Wolf
Overheads for Computers as
Components
Database records
 Database: set of records.
 Record: unlimited number of properties.
 Property types:
2-byte signed integer.
2-byte unsigned integer.
4-byte signed integer.
4-byte unsigned integer.
Time/date structure.
Null-terminated Unicode string.
Collection of bytes.
Boolean.
8-byte signed value.
© 2004 Wayne Wolf
Overheads for Computers as
Components
Database volumes
Volume: format for storing database in a
file.
Can be stored in compact flash, etc.
Must be mounted and dismounted.
© 2004 Wayne Wolf
Overheads for Computers as
Components
Windows CE modules and
processes
Types of executable code:
Applications .exe.
Dynamically linked libraries .dll.
A process is an instance of an application.
Each process has its own thread.
© 2004 Wayne Wolf
Overheads for Computers as
Components
DLLs vs EXEs
An executable can be executed.
A DLL cannot be directly executed.
Must be called by an EXE or DLL.
EXE can list the DLL in its import table.
DLL can be loaded explicitly.
Share file format.
Only difference is markers in the header.
© 2004 Wayne Wolf
Overheads for Computers as
Components
WinCE processes
Only 32 processes can execute at any one
time.
WinCE processes contain less state than
other Windows processes.
No current directory, etc.
© 2004 Wayne Wolf
Overheads for Computers as
Components
WinCE startup
When started, WinCE starts four
processes:
Kernel NK.exe.
System services FileSys.exe.
GUI support GWES.exe.
Device drivers Device.exe.
© 2004 Wayne Wolf
Overheads for Computers as
Components
WinCE threads
A thread is a flow of control.
Has its own stack and register set.
A process has one or more threads.
Primary process for threads.
Process can create an arbitrary number of
additional threads.
All threads in a process share the same
address space.
© 2004 Wayne Wolf
Overheads for Computers as
Components
Threads and scheduling
The kernel schedules threads.
Preemptive scheduling.
Time sliced into quanta.
Preemptive scheduling:
Higher priority ready thread runs first.
Thread can be blocked.
Scheduler supports priority inheritance to solve
priority inversion.
256 possible scheduling priorities.
© 2004 Wayne Wolf
Overheads for Computers as
Components
Priorities and quanta
Priority can be changed by the thread or
by another thread.
0 is highest priority, 255 is lowest.
Each thread may have its own time
quantum.
© 2004 Wayne Wolf
Overheads for Computers as
Components
WinCE fibers
Fiber: thread-like object that is scheduled
by the application, not the system.
Application creates thread, then turns it into
a fiber.
Introduced for better compatibility with
Unix.
© 2004 Wayne Wolf
Overheads for Computers as
Components
Thread local storage
Each thread that calls a routine can have
its own local storage.
Persistent.
Unique to a thread.
© 2004 Wayne Wolf
Overheads for Computers as
Components
WinCE synchronization
Based on synchronization objects.
Thread waits on synchronization object.
Signal to objectd causes thread to unblock.
© 2004 Wayne Wolf
Overheads for Computers as
Components
WinCE events
Event object capture signals:
Named objects.
In signaled or nonsignaled state.
Event object must be created in each
process that wants to use it.
Processes can wait on objects.
© 2004 Wayne Wolf
Overheads for Computers as
Components
Semaphore objects
Counting semaphores.
Zero count is not signaled.
Non-zero count is signaled.
Threads can wait on semaphore objects.
© 2004 Wayne Wolf
Overheads for Computers as
Components
Mutexes
Used to make sure that only one process
at a time works on a resource.
Signal is on when not owned by a thread.
Signal is off when owned by a thread.
© 2004 Wayne Wolf
Overheads for Computers as
Components
Critical sections
Critical section of code must not be
executed at same time as another critical
section.
Controlled by EnterCriticalSection(),
LeaveCriticalSection().
© 2004 Wayne Wolf
Overheads for Computers as
Components