News for hackers. Stuff that matters.
Re:Windows NT Kernel Contributor Explains Why Performance is... by yuhong on Saturday May 11, 2013 @02:51AM (#5689946)
My personal annoyance is the introduction of win32k in NT4. With per-session CSRSS existing since WinFrame and Vista+ having Session 0 Isolation, not to mention much faster processors, and the removal of XPDM and the requirement of the DWM in Win8, it doesn't make as much sense anymore.

Update: And I forgot to mention the font parsing security issues (look up Duqu), and the issues with user mode callbacks too.

Re:Windows NT Kernel Contributor Explains Why Performance is... by wfunction on Saturday May 11, 2013 @06:44AM (#5690273)
> the issues with user mode callbacks too.

Genuine question (because I really don't know) -- how do Linux GUI frameworks work without kernel-mode callbacks? What do they use instead, when they need to send messages to other windows?

Re:Windows NT Kernel Contributor Explains Why Performance is... by qb45 on Saturday May 11, 2013 @07:27AM (#5690326)
X11 clients communicate with the server using Unix domain sockets or TCP sockets. Requests, responses and event notifications are exchanged as messages.

Asynchronous communication is achieved using syscalls like select and poll which take a set of file descriptors (files, special files, sockets) and block the calling thread until some descriptor from this set has new data available for reading, starts accepting writes or signals an error.

GUI toolkits repeatedly poll the X server descriptor, parse incoming messages and call application-defined callbacks.

Re:Windows NT Kernel Contributor Explains Why Performance is... by wfunction on Saturday May 11, 2013 @02:10PM (#5691474)
> poll and select

That sounds like it's basically the same thing as Windows (GetMessage or MsgWaitForMultipleObjectsEx anyone?)... only that now you don't have the ability to use SendMessage, and need to rely exclusively on PostMessage instead.

Is that correct?

Re:Windows NT Kernel Contributor Explains Why Performance is... by quotemstr on Monday May 13, 2013 @04:10AM (#5697661)
Between threads, you rely exclusively on PostMessage anyway. You can't directly call into a routine on a different thread, so SendMessage to a window owned by another thread just posts the message to a special queue that's serviced before the regular message queue, then blocks until the other thread's window procedure processes the message.

In all boils down to message-passing: in Windows, the win32k is the trusted third party that mediates interactions between different window-system clients. In the X11 case, the X server and the window manager work together to do the same job. The architecture are fundamentally similar.

Re:Windows NT Kernel Contributor Explains Why Performance is... by wfunction on Monday May 13, 2013 @05:33AM (#5697867)
Hmm... yeah, that does sound very similar.

Why does Windows need kernel-to-user callbacks in the first place then? Now I'm thinking it shouldn't even be necessary at all...

Re:Windows NT Kernel Contributor Explains Why Performance is... by quotemstr on Monday May 13, 2013 @10:04PM (#5702666)
Re:Windows NT Kernel Contributor Explains Why Performance is... by wfunction on Tuesday May 14, 2013 @12:25AM (#5703004)
Thanks, I took a look at that... but it doesn't seem to quite explain what I meant. I was thinking more like, there's no need for SendMessage() to go from user->kernel->user, even when it's on the same thread. It could just do a system call to get the wndproc for the given window, then call the wndproc from user-mode directly.

Wouldn't that completely avoid needing to call back into user-mode from kernel mode?

Re:Windows NT Kernel Contributor Explains Why Performance is... by yuhong on Thursday May 16, 2013 @08:52PM (#5722156)
It does this already when the window is on the same thread if no window hooks are installed. When the window is on a different thread, it is GetMessage or PeekMessage on the target thread that notices the sent message and does the user-mode callback to call the window procedure.
Re:Windows NT Kernel Contributor Explains Why Performance is... by quotemstr on Saturday May 11, 2013 @02:59AM (#5689962)
Nobody likes win32k, but it's there and it works.

Okay, you're in charge. Are you sure you can't find a better way to deploy shareholder capital than using it to remove win32k?

Re:Windows NT Kernel Contributor Explains Why Performance is... by Zigurd on Saturday May 11, 2013 @11:03AM (#5690788)
"Okay, you're in charge. Are you sure you can't find a better way to deploy shareholder capital than using it to remove win32k?"

Could that be why developing an OS inside of a shareholder-owned corporation is inherently hobbled compared with developing it as an open source project?

Re:Windows NT Kernel Contributor Explains Why Performance is... by kvb on Saturday May 11, 2013 @11:25AM (#5690877)
Open source projects have to prioritize resources, too. It's not like open source projects are known for their lack of cruft.
Re:Windows NT Kernel Contributor Explains Why Performance is... by Zigurd on Saturday May 11, 2013 @12:18PM (#5691070)
> It's not like open source projects are known for their lack of cruft.

True, but resource allocation is distributed between volunteer contributors, sponsored contributors who may have different sponsors, downstream consumers of a project, and people involved in project governance. That can make it easier to try new approaches.

Re:Windows NT Kernel Contributor Explains Why Performance is... by kvb on Saturday May 11, 2013 @03:46PM (#5691868)
I don't think commercial vs. open source really affects that much - regardless of open-source-ness, different projects are run in different ways. Just to give two examples, surely Office's switch to the Ribbon (and putting Office Apps online) was more speculative (or disruptive, or innovative, or whatever you want to call it) than anything being done by the open source office suites. Likewise, Visual Studio 2010 represented a big break from the past with a switch to many managed APIs driving their extensibility story (including the move to WPF for their UI), which was a huge change from their existing COM APIs.

Not all commercial projects are run like Windows, and it seems to me that most of their conservatism doesn't come from lazy or shoddy or shortsighted developers and managers, but rather their large number of hardware and software partners who take dependencies on undocumented implementation details (see Raymond Chen's blog for a virtually infinite supply of such anecdotes).