pigfoot’s weblog

We should forget about small efficiencies — Donald Knuth

Archive for the ‘Develop’ Category

Zero copy between ISR, kernel and User, from LKML.

Q:

I would like to allow the transferring of data between ISR’s, kernel and user code, without requiring copying.

I envision allocating buffers in the kernel and then mapping them so that they appear at the same addresses to all code, and never being swapped out of memory.

Is this feasible for all supported Linux architectures and is there existing code that someone could point me towards?

A:

Your better off having application mmap a device, then transfer the data to there. Something like AF_PACKET.

Popularity: 15% [?]

  • 0 Comments
  • Filed under: Develop, Kernel
  • POSIX Asynchronous I/O

    POSIX Asynchronous I/O, from OSNews.

    Used judiciously, asynchronous I/O (short for AIO) can provide a significant speed benefit, says David Chisnall. Perhaps enough to help your program overcome the fact that modern processors can really zoom, while hard drives still drag.

    Code using AIO on Linux must be linked with -lrt to provide support for the POSIX real-time extensions, which means it may not be the kernel I/O mechanism, especially Kernel AIO Support for Linux has not been merged into mainline kernel yet.

    After studying rt extensions in glibc source, I find how do they implement posix AIO in glibc — a thread pool plus a request waiting queue. Besides, helper thread will be spawned to manage the request, hence it’s not so trivial.

    There is something interesting when freeing allocated resources. You can see the function libc_freeres_fn() in aio_misc.c. This is also why it is unnecessary to implement “destroy” API.

    Whereas, FreeBSD has AIO family system calls. I, however, have no experience with AIO in FreeBSD, but it seems AIO in FreeBSD has kernel support? If so, it would be more efficient than Linux until now?

    Popularity: 15% [?]

  • 0 Comments
  • Filed under: Develop, Kernel
  • Cool picture of all the new Vista Icons.

    Windows Vista 256x256 high-resolution icons

    Besides, here is a tutorial from MSDN on how Microsoft makes their Windows XP icons.

    Popularity: 33% [?]

  • 0 Comments
  • Filed under: Develop, Windows
  • Elevate through ShellExecute

    Elevate through ShellExecute, from Vista Compatibility Team Blog.

    We often get the question how to elevate a process through ShellExecute. From the docs it is not immediately clear. The trick is passing in “runas” in the lpVerb.

    Here is a snippet to run notepad elevated.

    #include “stdafx.h”
    #include “windows.h”
    #include “shellapi.h”

    int _tmain(int argc, _TCHAR* argv[])
    {
        SHELLEXECUTEINFO shExecInfo;

        shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);

        shExecInfo.fMask = NULL;
        shExecInfo.hwnd = NULL;
        shExecInfo.lpVerb = L”
    runas“;
        shExecInfo.lpFile = L”notepad.exe”;
        shExecInfo.lpParameters = NULL;
        shExecInfo.lpDirectory = NULL;
        shExecInfo.nShow = SW_MAXIMIZE;
        shExecInfo.hInstApp = NULL;

        ShellExecuteEx(&shExecInfo);

        return 0;
    }

    Here is some screenshot:

    RunAS

    Popularity: 31% [?]

  • 1 Comment
  • Filed under: Develop, Windows
  • Python 2.5 released

    Python

    Python 2.5 final released!, from digg.

    This release (mailing list announcement) includes:

    • PEP 308: conditional expressions
    • PEP 328: absolute and relative imports
    • PEP 341: unified try/except/finally
    • PEP 342: new generator features
    • PEP 343: the ‘with’ statement
    • new packages: ctypes, ElementTree, hashlib, sqlite, wsgiref

    For more details, you can refer to Python 2.5 what’s new.

    Popularity: 14% [?]

    CLR Inside Out: IronPython

    CLR Inside Out: IronPython, from MSDN Magazine

    IronPython is the code name for an implementation of the Python programming language written by the CLR team at Microsoft. IronPython runs on the Microsoft .NET Framework and supports an interactive console with fully dynamic compilation. It is well integrated with the rest of the .NET Framework and makes all .NET libraries easily available to Python programmers, while maintaining full compatibility with the Python language.

    This column will give a brief overview of Python and what sets dynamic languages apart from other languages. I will discuss iterative development, describe how IronPython integrates with .NET while staying true to Python syntax, and show the advantages of using IronPython to utilize .NET.

    Besides, Here are some sample codes on CodePlex:

    Popularity: 10% [?]

  • 0 Comments
  • Filed under: Develop, Python
  • Peer to Peer (p2p) in Windows Vista – People Near Me API from ebooth’s blog.

    The overview of the p2p APIs available in Windows Vista is:

    • PNRP (Peer Name Resolution Protocol) is like server-less DNS. It allows clients to register secured and unsecured peer names that can be resolved over the internet. Currently large data centers are required to host services that PNRP has the potential to replace. PNRP gives people the ability to discover a friend and see their presence online and then play a game or work on a project together.
    • PNM (People Near Me) allows for dynamic discovery and invitation of computers running Windows Vista on the same subnet or Ad-hoc wireless. This means you can play games with people in the airport, swap photos with your friends or collaborate with colleagues. For example Windows Meeting Space uses PNM.
    • Peer Naming API allows email providers to tie PNRP names to email addresses. Then any program that uses the WinSock APIs can resolve registered email addresses. This means you can literally ping a friend or put their email address where you would have to put an IP address in a game.
    • Graphing is a mesh networking API. It allows groups of people to share information and collaborate. A game could create a mesh of online players so that it could do server-less match making. Or an evangelism team could collaborate on a document without having to upload the latest copy to a server.
    • Grouping is the security component of Graphing. It allows for a group to be administrated, so that membership and permissions can be restricted. Think of Grouping and Graphing as a database in the cloud.
    • Peer Channel is the only managed API in the P2P API suite. It allows for mesh replication instead of mesh collaboration.
    • Application Invite (AppInvite) allows a user to invite another user to use a collaboration application. Any application can register with the invite API and when a user sends an invite to use that application the application will be launched by Windows Vista. Windows Meeting Space is an example of an application that uses AppInvite.
    • Contacts API allows the creation and administration of p2p contacts.
    • Serverless Presence: Gets contact presence information.

    Popularity: 27% [?]