English
========================================================================
Introduction
When using Enhanced Write Filter (EWF) in RAM or RAMREG mode several customers might assume
the EWF overlay is limited solely by the availability of physical memory. Consequently, many assume
they will be able to achieve an overlay twice as big on a system with 2 GB RAM than on a system with 1
GB RAM. This is not true by any means. This article explains the factors that limit the overlay size and
the significant improvements seen on Windows Embedded Standard 2011.
If you are interested more in the conclusion than the internals, skip the following sections and jump
directly to the “Results and Conclusion” section.
EWF memory allocation internals
EWF maintains a list of memory descriptor lists (MDLs) that describe the entire overlay. Using MDLs is
the preferred memory allocation technique for kernel mode drivers that have huge memory needs that
exceed the Paged Pool or Non Paged Pool limits. The overlay size is increased on a "need to" basis
and not pre-allocated in DriverEntry. Whenever a new write arrives and it cannot be accommodated in
the overlay, we allocate a new MDL that describes 64 KB, increasing the overlay size by 64 KB. No
more allocations are needed until we run out of this 64 KB chunk. This continues until the system cannot
allocate any more MDLs. Next, I will explain why this happens much before we actually run out of
physical memory on the system.
Each MDL describes a set of pages – in the case of EWF, we use MDLs that describe 16 physical pages
(64 KB per MDL / 4 KB per page = 16 pages per MDL). To map these 16 noncontiguous physical pages
into 16 contiguous virtual pages, the operating system needs 16 Page Table Entries (PTEs). Specifically,
it needs 16 system PTEs because MDLs don't use regular PTEs. So each time the overlay grows by 64
KB we have 16 fewer system PTEs.
System PTEs are not an unlimited resource and their total number does NOT increase linearly with
physical memory. So the EWF overlay size will be limited by the availability of system PTEs and NOT by
the availability of physical memory. Also, note that system PTEs are also used by the operating system
and other kernel mode drivers (a big chunk by the video drivers)
The next question is – How many system PTEs does Windows provide? It varies and the primary factors
are the version of Windows (Windows XP vs. Windows 7) and the processor architecture (x86 vs. x64).
The exact numbers are not documented on MSDN, but you can easily find out for yourself using
Windbg.
Using Windbg to determine the system PTE information
1. Enable kernel debugging on the target system and restart the machine. You can either debug
remotely using a serial / 1394 cable OR use local kernel debugging.
2. Launch Windbg and set the symbol path to the Microsoft public symbols server
3. Use the Windbg command “!sysptes” to get the information on system PTEs. You can use
debugger help (.hh !sysptes) for details about this command.
Results and Conclusion
o “.sympath SRV*C:\PublicSymbols*http://msdl.microsoft.com/download/symbols”
Windows Embedded Standard 2009 (32 bit edition) vs. Windows Embedded Standard 2011 (32 bit
edition)
Note: On Windows XP, there is a memory management setting that can help increase the system PTEs
(compared to default behavior on Windows XP). To use this, set the following REG_DWORD to 0xffffffff.
“HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory
Management! SystemPages”. This setting is not used by the Memory Manager in Windows 7.
Here’s how you should interpret the results - On Windows Embedded Standard 2009 with 2GB of RAM,
system PTEs can only describe up to 1007484 KB (~ 984MB). The EWF overlay limit will be lesser than
this owing to system PTE usage by other drivers and the operating system. In my experiments, I
observed this usage to be around 300MB, thus limiting the EWF overlay to about 684 MB. The
improvement in Windows Embedded Standard 2011 is impressive and hard to miss. On Windows
Embedded Standard 2011 with the same configuration, system PTEs can describe up to 1709952 KB
(1670 MB). Assuming similar system PTE usage by other components, EWF overlay can be as large as
1370 MB. The overlay limit has roughly doubled from Windows Embedded Standard 2009 to Windows
Embedded Standard 2011.
You will also notice that limits on 2GB system are smaller than that on a 1GB system. To reiterate my
earlier point, system PTEs don’t increase linearly with RAM. With more physical memory, the kernel
needs to maintain larger book keeping structures (such as the PFN database), hence the increasing
physical memory from 1 GB to 2 GB is not beneficial if you are looking to improve overlay limit. It is
however beneficial for RAM hungry user mode processes.
Windows Embedded Standard 2011 (64 bit edition)
On 64 bit edition of Windows, the kernel address space is much larger (both theoretical and supported)
and system PTEs can describe up to 128 GB of RAM. However, EWF on Windows Embedded Standard
2011 has only been tested on systems up to 4 GB of RAM. If you have embedded scenarios that use
more RAM, please provide feedback either on the forums or the connect website. Refer to the product
documentation that will accompany Windows Embedded Standard 2011 RTM for the final word on this.
Conclusions and call for action
1. Estimate the overlay needs for your embedded scenario, compare it with the chart above and
decide the correct platform (Windows Embedded Standard 2009 or Windows Embedded
Standard 2011).
2. Consider using 64 bit edition of Windows Embedded Standard 2011 if you need more overlay
space than what is offered by the 32 bit edition.
3. As always, provide feedback!
Reference: Windows Embedded
中文
========================================================================
在 EWF RAM 或是 EWF RAM(Reg) mode 使用上,經過測試發現會有一些限制,上面是我之前在搜尋資料所找到的文章,從文章可以發現,在 EWF RAM 或是 EWF RAM(Reg) mode 中,最多能使用的記憶體空間約為500 MB,當超過500 MB時,系統會開始不聽使喚,有可能連執行關機的指令都有問題,必須強制斷電進行重開機。
2015年8月17日 星期一
EWF RAM and RAM(Reg) Mode 續談 EWF
English
========================================================================
Reference by MSDN
中文
========================================================================
EWF 第二種 mode 為 RAM mode,此保護機制是使用把所有原本要寫到 HDD 內的修改,全部轉存在 RAM 上,由於 RAM 的特性,在系統斷電或是重新開機時,會清除 RAM 上的資料,藉此保持系統的安全與完整性。RAM mode的配置如下:
1. EWF 覆蓋層儲存於記憶體中
2. EWF volume 儲存於磁碟中
EWF RAM mode 所配置的 RAM 的大小,為非預先配置,因此 EWF RAM mode 能使用的 free 記憶體大小,最多為系統所剩下的 free 記憶體大小。
EWF 第三種 mode 為 RAM(Reg) mode,此保護機制與 RAM mode 相似,不同的地方為此 mode 把 EWF volume 改存在系統的 Registry 中,因此 RAM(Reg) mode 的配置如下:
1. EWF 的覆蓋儲存於記憶體中
2. EWF volume 是儲存於注冊表中
========================================================================
There are three different modes of EWF based on the different configurations for the EWF overlay and the EWF volume.
| EWF Mode | EWF Overlay Location | EWF Volume Location | Description |
|---|---|---|---|
| Disk | On disk | Created on disk in unpartitioned space | EWF stores overlay information in a separate partition on the system. Because the overlay is stored in a nonvolatile location, the EWF overlay information can persist between reboots.
Use EWF Disk types on a system if you want to maintain the state of the system.
For more information, seeEWF Disk Mode.
|
| RAM | In RAM | Created on disk in unpartitioned space | EWF stores overlay information in RAM. When the system is rebooted, all of the information in the overlay is discarded.
Use EWF RAM types on systems if you want to discard any write information after reboot, or to delay writing the overlay to the media.
For more information, seeEWF RAM Mode.
|
| RAM Reg | In RAM | In system registry | Similar to EWF RAM types, RAM Reg overlays store overlay information in RAM. However, the configuration information about EWF is not stored in a separate EWF volume, but within the registry.
Use EWF RAM Reg types on media that does not support changing the partition structure of the media, such as CompactFlash. CompactFlash media is typically marked as removable media. Removable media cannot be partitioned. For more information, seeCompactFlash Design Considerations.
For more information, seeEWF RAM Reg Mode.
|
中文
========================================================================
EWF 第二種 mode 為 RAM mode,此保護機制是使用把所有原本要寫到 HDD 內的修改,全部轉存在 RAM 上,由於 RAM 的特性,在系統斷電或是重新開機時,會清除 RAM 上的資料,藉此保持系統的安全與完整性。RAM mode的配置如下:
1. EWF 覆蓋層儲存於記憶體中
2. EWF volume 儲存於磁碟中
EWF RAM mode 所配置的 RAM 的大小,為非預先配置,因此 EWF RAM mode 能使用的 free 記憶體大小,最多為系統所剩下的 free 記憶體大小。
EWF 第三種 mode 為 RAM(Reg) mode,此保護機制與 RAM mode 相似,不同的地方為此 mode 把 EWF volume 改存在系統的 Registry 中,因此 RAM(Reg) mode 的配置如下:
1. EWF 的覆蓋儲存於記憶體中
2. EWF volume 是儲存於注冊表中
2015年8月16日 星期日
Enhanced Write Filter (EWF) overview 初談EWF
English
========================================================================
Reference from MSDN
中文
========================================================================
EWF 是微軟提出一種保護硬碟的方法,此方法可以避免作業系統受到不正常的使用,造成資料的損毀。EWF 的作用原理,大致上就是把系統開機後所更改的所有設定,鏡射到 HDD 或 RAM 上,當系統重新開機時,會把 HDD 和 RAM 上的資料全部清除掉,來達到防寫的功能。
EWF 有三種 mode,第一種為 Disk mode,此方式需要再建立硬碟 partition 時,須預留未配置的空間,以供給給 EWF 使用;當系統在執行 First Boot Agent (FBA)時,他會先創立一個名為 EWF partition 的空間,在 EWF partition 中,又包含 EWF volume 和 EWF disk overlay,EWF volume為一個小於32MB的空間,他記錄 EWF 中所需的資料,EWF disk overlay為類似之前 Windows 的還原點,EWF 可以建立最多9個還原點,讓客戶自由設定;EWF Disk mode 的配置如下圖:
下圖為系統有使用多個 EWF disk overlay,每個 EWF disk overlay 都記錄當時作業系統的狀態,使用者可以依造自己的需求,做不同狀態的還原。
========================================================================
The Enhanced Write Filter (EWF) protects a volume from write access. EWF provides the following benefits:
- Write-protects one or more partitions on your system
- Enables read-only media, such as CD-ROM or flash, to boot and run
EWF can be deployed on a variety of media types and configurations. The two major components for EWF are the EWF Overlay and the EWF Volume:
- EWF Overlay: EWF protects the contents of a volume by redirecting all write operations to another storage location. This location is called an overlay. An EWF overlay can be in RAM, or on another disk partition. An overlay is conceptually similar to a transparency overlay on an overhead projector. Any change that is made to the overlay affects the picture as it is seen in the aggregate, but if the overlay is removed, the underlying picture remains unchanged. For more information, see EWF Modes.
- EWF Volume: In addition to the EWF overlay, an EWF volume is created on the media in unpartitioned disk space. This EWF volume stores configuration information about all of the EWF-protected volumes on the device, including the number and sizes of protected volumes and overlay levels. Only one EWF volume is created on your device, regardless of how many disks are in the system. If your media does not support multiple partitions, you can save the EWF configuration information in the system's registry. For more information, see EWF Volume Configuration.There can be only one EWF volume on the system. However, there can be more than one protected volume, and it is possible to have some volumes that are protected by disk overlays while others are protected by RAM overlays.
There are three different modes of EWF based on the different configurations for the EWF overlay and the EWF volume.
| EWF Mode | EWF Overlay Location | EWF Volume Location | Description |
|---|---|---|---|
| Disk | On disk | Created on disk in unpartitioned space | EWF stores overlay information in a separate partition on the system. Because the overlay is stored in a nonvolatile location, the EWF overlay information can persist between reboots.
Use EWF Disk types on a system if you want to maintain the state of the system.
For more information, seeEWF Disk Mode.
|
| RAM | In RAM | Created on disk in unpartitioned space | EWF stores overlay information in RAM. When the system is rebooted, all of the information in the overlay is discarded.
Use EWF RAM types on systems if you want to discard any write information after reboot, or to delay writing the overlay to the media.
For more information, seeEWF RAM Mode.
|
| RAM Reg | In RAM | In system registry | Similar to EWF RAM types, RAM Reg overlays store overlay information in RAM. However, the configuration information about EWF is not stored in a separate EWF volume, but within the registry.
Use EWF RAM Reg types on media that does not support changing the partition structure of the media, such as CompactFlash. CompactFlash media is typically marked as removable media. Removable media cannot be partitioned. For more information, seeCompactFlash Design Considerations.
For more information, seeEWF RAM Reg Mode.
|
中文
========================================================================
EWF 是微軟提出一種保護硬碟的方法,此方法可以避免作業系統受到不正常的使用,造成資料的損毀。EWF 的作用原理,大致上就是把系統開機後所更改的所有設定,鏡射到 HDD 或 RAM 上,當系統重新開機時,會把 HDD 和 RAM 上的資料全部清除掉,來達到防寫的功能。
EWF 有三種 mode,第一種為 Disk mode,此方式需要再建立硬碟 partition 時,須預留未配置的空間,以供給給 EWF 使用;當系統在執行 First Boot Agent (FBA)時,他會先創立一個名為 EWF partition 的空間,在 EWF partition 中,又包含 EWF volume 和 EWF disk overlay,EWF volume為一個小於32MB的空間,他記錄 EWF 中所需的資料,EWF disk overlay為類似之前 Windows 的還原點,EWF 可以建立最多9個還原點,讓客戶自由設定;EWF Disk mode 的配置如下圖:
訂閱:
文章 (Atom)
OS Operating System 作業系統 恐龍書 筆記分享
發現一個作業系統說明的網站, 對於 process vs thread, semaphore vs mutex, deadlock 說明很詳細, 有興趣的人可以去以下的網頁逛逛。 附上網址連結: link link2
-
English ======================================================================== Today I'll introduce how to connect on ethernet by us...
-
發現一個作業系統說明的網站, 對於 process vs thread, semaphore vs mutex, deadlock 說明很詳細, 有興趣的人可以去以下的網頁逛逛。 附上網址連結: link link2
-
English ======================================================================== We use sample code to implement the Serial port transmiss...



