Steven's profileLunatic ExperimentsPhotosBlogLists Tools Help

Blog


    June 23

    Virtual Memory Management In .NET

    The hit counter for my blog has just the 10,000 hit milestone today. I had planed to release a comedic themed encryption library for Powershell that shows how some of the functions of GPG can be imitated in Powershell. However, I have not yet finished that library. Instead, I have decided I would release a virtual memory management library I wrote in C#.

    One of the projects I'm working on right now required a better understanding of the CPU architectures used today. This inevitably lead me to want to be able to use ASM in C# code. So I decided to start studying NASM and ASM in general, and then found that the .NET heap has execution protection. I then found that I can control the protection bits by calling the virtual memory management functions in the kernel32.dll library. This library is a .NET wrapper for those functions.

    The library is documented, but I don't have any example uses that I can release at this time. While I don't have any examples to release today I can say that this library is useful for executing either precompiled or dynamically generated native code.

    The library is released under the GNU General Public License.
    VirtualMemory.7z

    On the topic of ASM: I have read a few negative comments in the past about how well the .NET Framework is able to optimize the native code result of an assembly, particularly in the use of SIMD instructions. I feel I should comment on my experience while developing this library. I tested the execution time of two algorithms written in both NASM and C#. The execution time of the first algorithm I tested was ~10 times faster in NASM than what I got from the C# version. On the other hand, the execution time of the second algorithm I tested was only ~10% faster in NASM than in C#, and only after a couple hours of work to optimize the NASM code.
    According to my calculations, the speed result of the second algorithm in C# came very close the theoretical limit of my CPUs capacity, close enough that there would be no way to achieve that speed without the use of wide SIMD instructions. This indicates to me that the JITter in .NET Framework is capable of using SIMD instructions properly, while the same JITter may not always understand the algorithm being JITted. This is actually completely inline of my expectations for any compiler.
    June 10

    "Detainee Photographic Records Protection Act of 2009"

    I just found something that has reminded me that the U.S.A. is not a democracy. I just discovered that section 1305 of H.R.2346 has the explicit purpose of allowing the Secretary of Defense the unrestricted right to prevent the publication of any photograph taken by US Armed Forces "relating to the treatment of individuals engaged, captured, or detained after September 11, 2001," and this right can not be circumvented by the Freedom of Information Act.
    From what I can see, section 1305 was removed from the bill by the House of Representatives, however, passed by the Senate.

    It is argued that the events of September 11, 2001 occurred because of an anti-American mentality. It is clear by the date used that the bill is designed to censor evidence of wrong doing by Bush Administration. Condoning actions made by a previous administration that would reflect negatively against the U.S.A. can only perpetuate this anti-American mentality. I can only suspect that anyone that attempts to prevent the publication of the evidence of any act condones the act represented by the evidence.

    In summery, I can not see how section 1305 of H.R.2346 could benefit the U.S.A. so I am explicitly stating my dissent to this bill. I hope that anyone with the power to stop ratification of section 1305 does so, and that whoever wrote it is removed from D.C.

    I am including a copy of section 1305 for your information.
      Sec. 1305. (a) Short Title- This section may be cited as the `Detainee Photographic Records Protection Act of 2009'.
      (b) Definitions- In this section:
        (1) COVERED RECORD- The term `covered record' means any record--
          (A) that is a photograph that was taken between September 11, 2001 and January 22, 2009 relating to the treatment of individuals engaged, captured, or detained after September 11, 2001, by the Armed Forces of the United States in operations outside of the United States; and
          (B) for which a certification by the Secretary of Defense under subsection (c) is in effect.
        (2) PHOTOGRAPH- The term `photograph' encompasses all photographic images, whether originals or copies, including still photographs, negatives, digital images, films, video tapes, and motion pictures.
      (c) Certification-
        (1) IN GENERAL- For any photograph described under subsection (b)(1)(A), the Secretary of Defense shall certify, if the Secretary of Defense, in consultation with the Chairman of the Joint Chiefs of Staff, determines that the disclosure of that photograph would endanger--
          (A) citizens of the United States; or
          (B) members of the Armed Forces or employees of the United States Government deployed outside the United States.
        (2) CERTIFICATION EXPIRATION- A certification submitted under paragraph (1) and a renewal of a certification submitted under paragraph (3) shall expire 3 years after the date on which the certification or renewal, as the case may be, is submitted to the President.
        (3) CERTIFICATION RENEWAL- The Secretary of Defense may submit to the President--
          (A) a renewal of a certification in accordance with paragraph (1) at any time; and
          (B) more than 1 renewal of a certification.
        (4) CERTIFICATION RENEWAL- A timely notice of the Secretary's certification shall be provided to Congress.
      (d) Nondisclosure of Detainee Records- A covered record shall not be subject to--
        (1) disclosure under section 552 of title 5, United States Code (commonly referred to as the Freedom of Information Act); or
        (2) disclosure under any proceeding under that section.
      (e) Nothing in this section shall be construed to preclude the voluntary disclosure of a covered record.
      (f) Effective Date- This section shall take effect on the date of enactment of this Act and apply to any photograph created before, on, or after that date that is a covered record.
    June 01

    Google Wave

    This is a must see. http://wave.google.com/
    This is the best collaborative software that I have seen. The best thing is that it will be free to use and organizations will have the ability to set up their own private wave servers. I am very exited about this and, as you might already suspect, I do have plans for this once it moves into the public.