Jump to content

Wikipedia:Reference desk/Archives/Computing/2010 October 31

From Wikipedia, the free encyclopedia
Computing desk
< October 30 << Sep | October | Nov >> November 1 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


October 31

[edit]

Multitasking OS - program memory allocation

[edit]

(if specific - Windows) In a multitasking OS such as windows there can be numerous processess and programs running (using time division multitasking amongst other things I think) - what I don't understand is how memory is allocated between these processes/programs - specifically in terms of a stack.

eg A program might need a huge stack, but the size of the stack would be unknown before runtime.. My main question is - how are program stacks handled? one shared stack, or one stack per program in program memory space? What about if the stack gets really big? Does the processor have special features to detect stacks going outside a set space? I might need a windows memory organisation 101 lesson first.. where to look? Thanks.77.86.42.103 (talk) 00:02, 31 October 2010 (UTC)[reply]

Windows Internals by Russinovich and Solomon is pretty good. There's one stack per thread (not per process); when a context switch occurs the stack-pointer is among the registers that get saved and restored. Different OSes handle allocation for the stack slightly differently (and I don't know offhand how Windows does it). Ideally a process would allocate so many pages of system memory for the stack; if a thread used more than that (e.g. it did some extensive recursive operation) then it runs off the end of the stack segment, causing a memory violation. The kernel responds by allocation more physical pages to the virtual memory space for the stack, amends its own tables marking the stack segment as having expanded, and returns control to the process. In practice this can go on for a while, but a sensible OS will limit the size to which a stack can grow (otherwise a trivial, defective program can consume all the memory by recursing itself) - a program that goes over its limit will be terminated. -- Finlay McWalterTalk 00:10, 31 October 2010 (UTC)[reply]
Note that this the case for user space processes (that is, applications and services). How stacks work for kernel level "processes" and things like interrupt handlers is a rather difficult matter. -- Finlay McWalterTalk 00:25, 31 October 2010 (UTC)[reply]
The Win32 Thread Information Block stores details about the current thread's stack size. Russinovich talks about the TIB several times, and says pages are allocated to it with a 64Kb granularity. -- Finlay McWalterTalk 00:23, 31 October 2010 (UTC)[reply]
(follow on question to first part, still reading) Thanks that's what I was looking for. Question - "runs off the end of the stack segment, causing a memory violation" - is this detected by the processor? I assume it has to be .. what would be a good search term for the x86 or x64 implementation of this?
also a minor question .. in Task Manager eg File:System idle process.png - in terms of the above answer - is each "process" shown in that windows program a "thread" or "process" - don't matter if not known - my question has been already mostly answered.77.86.42.103 (talk) 00:27, 31 October 2010 (UTC)[reply]
Yes. The Global Descriptor Table stores Task State Segments which store the addresses of virtual memory blocks allocated to the process. Accessing memory outwith that allocated to you causes a protection fault, which is handled by the kernel. Although users are familiar with protection faults as program-killing errors, OSes which run on CPUs with memory management units also (transparently) use protection faults to implement growable stacks, copy-on-write, and handling of paging data and executables to and from disk/memory. -- Finlay McWalterTalk 00:34, 31 October 2010 (UTC)[reply]
Regarding Task Manager - each thing it shows is a process, I believe. Some processes have many threads. Microsoft's Process Explorer (which Russinovich wrote) will, I think, show the threads within each process. It's a free download (and safe, given its source); if you're interested in how Windows works, it's a really interesting way to waste the rest of your evening. -- Finlay McWalterTalk 00:37, 31 October 2010 (UTC)[reply]
Regarding books: apart from Russinovich (who I think will explain this only rather tangentially) it's difficult to recommend a decent book. The underlying technology is covered at length in the Intel Software Developer's Manuals, but those are written from a pretty low-level perspective, for people who already know how conceptually to write a virtual-memory subsystem and task switch handler. Probably the best thing I've read is McKusick's The Design and Implementation of the 4.4 BSD Operating System - really all (mainstream, non embedded, single-computer) operating systems work in much the same way. -- Finlay McWalterTalk 00:56, 31 October 2010 (UTC)[reply]
Great Global Descriptor Table and Task State Segment almost certainly answer my initial question. I really didn't have a hope of finding it on my own. I agreee McKusicks book is good found it here - one of those works that makes me feel I could start writing an OS today, and probably have it finished in a couple of weeks .. :) 77.86.42.103 (talk) 01:18, 31 October 2010 (UTC)[reply]
Resolved

Wireless modem capabilities

[edit]

Can wireless modems generally be used to dial "information numbers" (i.e., things like this1) and send and receive text messages to perform an account's administrative tasks (e.g., refill balance, order services, etc.)? 125.163.228.155 (talk) 07:00, 31 October 2010 (UTC)[reply]

1) This is just an example. I am not an AT&T customer.

(answering self) Well, after reading various wireless modems' user manuals, it quickly became apparent to me that most wireless modems are only capable of the following (at least from the modem's user interface, not accounting from writing AT commands directly):
  • connecting to the Internet,
  • sending and receiving text messages,
  • "managing" the SIM/RUIM's inbox, outbox, and other *boxes, and
  • "managing" the SIM/RUIM's contact list.
So, in conclusion, unless I can do an account's maintenance tasks (activating the Internet service, checking account balance, refilling account balance, ordering data packages, etc.) solely through text, it is probably not a good idea to have a wireless modem without having a cell phone. 125.163.226.148 (talk) 00:42, 2 November 2010 (UTC)[reply]

Installing Starcraft 2 On Ubuntu Using Wine

[edit]

My Vista computer completely crashed on me so I decided to install Ubuntu (I downloaded 10.10). I'm not really technically proficient, and all I plan to use my computer for is Internet, Word, Netbeans, and Starcraft 2. However, after installing wine and following the instructions here, when I try to run the installer I get the error message: " No installer data could be found. If this problem persists, please contact Blizzard Technical Support.".

Does anyone have any idea how I can resolve this? Secondly, since I downloaded Ubuntu I figure I should try to use some of this amazing functionality linux should let me have. However I feel kind of overwhelmed learning it. Does anyone have any suggestions on how I should go about learning to use ubuntu?

Thanks --66.133.196.152 (talk) 09:09, 31 October 2010 (UTC)[reply]

Sorry if I sound annoying, but why not just go back to Windows? It should bring up no problems then, as most feature games are designed for Windows.General Rommel (talk) 09:48, 31 October 2010 (UTC)[reply]
You do sound annoying, and this is not a helpful response at all. We've established many times over that "switch to X" is not an appropriate response when someone is asking for help with their current OS. It should frankly be removed.. --Mr.98 (talk) 11:48, 31 October 2010 (UTC)[reply]
It's not half as annoying as when someone takes on the self-appointed role of policeman. 92.15.26.46 (talk) 15:30, 31 October 2010 (UTC)[reply]
There are no policemen here, just other citizens. My right to criticize poor responses is as enshrined as your own. --Mr.98 (talk) 18:42, 31 October 2010 (UTC)[reply]
I agree the response is poor, but one thing I would suggest is if you never actually tried Starcraft on Windows, and presuming you can relatively easily install it, consider a temporary copy. If the problem persists on Windows, you know it's probably not be Linux related and are free to contact Blizzard. Nil Einne (talk) 21:11, 31 October 2010 (UTC)[reply]
And to Mr 98, I apoligize, however I have only been here for only a few times over this year and I believe that we should consider all possibilities, which colud also include going back to Windows. However, if Mr 98 disagrees you may bring it up on my talk page. General Rommel (talk) 21:29, 31 October 2010 (UTC)[reply]
Normally I, too, condemn recommendations of "switch to Windows / Mac OS / Linux" which are almost never helpful — but in this case, the original poster is a Windows user, using Windows Vista, who is not at all familiar with Linux, and is trying to play a Windows game. I think it's a good question why he doesn't reinstall Vista from scratch, under the circumstances. Comet Tuttle (talk) 15:36, 1 November 2010 (UTC)[reply]
Some programs need a bunch of tweaks for Wine for it to play them properly. The Wine forums tend to have quite a bit on them, but that might be daunting for a new user. Instead try installing PlayOnLinux (it's in the package managment system, so you'll get it using Synaptic). It has a specific line item for Starcraft II - Wings of Liberty. In general the Wine Database is showing people are having "Gold" and "Platinum" results playing Starcraft II on Wine - see here. -- Finlay McWalterTalk 12:02, 31 October 2010 (UTC)[reply]
I should clarify this - PlayOnLinux is a wrapper around Wine, providing a tailored "wine prefix" for an impressively wide range of programs - it's not a replacement for wine at all. -- Finlay McWalterTalk 12:30, 31 October 2010 (UTC)[reply]
You might also consider Cedega which is a pay-for, closed-source, spin-off of Wine. However, I notice that their database lists the game as "works with issues", which in my experience usually means that the software runs but has some glitches that make playing the game frustratingly impossible. APL (talk) 15:58, 1 November 2010 (UTC)[reply]

Font ID

[edit]

Can anyone help? :) ╟─TreasuryTagconstablewick─╢ 09:46, 31 October 2010 (UTC)[reply]

Identifont has some ideas, but none of them look right to me -- the best matches don't even have an italic version. Paul (Stansifer) 12:24, 31 October 2010 (UTC)[reply]
It looks to me like one of the standard fonts that used to be on Mac Systems 7-9, but the Fonts on Macintosh article doesn't really have on that matches up. It reminds me of Zapf Chancery but it is obviously not that. It has some resemblance to Bookman or Cheltenham, in the sense that both have sort of a "too filled, too big" look to them (to me, anyway) with similar flourishes at the ends of the letters, but neither of those are obviously the same one (they have different italic as, for example). --Mr.98 (talk) 18:40, 31 October 2010 (UTC)[reply]
For what it's worth, I google-image-searched artscroll font and this link is probably from the same source and uses what appears to be the same font. Comet Tuttle (talk) 15:39, 1 November 2010 (UTC)[reply]
I am no typographical expert, but the font really looks like ITC Benguiat® Book Italic. 125.163.226.148 (talk) 02:00, 2 November 2010 (UTC)[reply]

Error (?) in unit type article

[edit]

I think there may be a significant error in our unit type article, but I'm not sure, and I don't think I'd get a response on the talk page, so I'm asking here, with a really long sentence.

According to our article, the unit type is the return type of functions that return no value. But consider the following proposition: "a function which returns no value can be changed to return a value without breaking anything else". Obviously, this should be true. This statement is equivalent to "a function type which has a return type is a subtype of the function type with the same argument types but no return type". Yet, if the unit type is the static return type of functions which return no value, this isn't true. The reason is that function return values are covariant, and whatever the return type of the function is, it's not a subtype of the unit type. The static unit type provides some information (its type), even though the runtime unit type doesn't.

The only type that provides no information whatsoever is the top type. So, to be pedantic correct, it seems like the article should say that the static return type of functions that return no useful information is the top type, and the actual value returned by such functions is (presumably) the unit.

To make this more concrete: functions from void to int cannot be substituted for functions from void to void. However, they can be substituted for functions from void to object.

So... am I right, and the article needs to be changed, or am I just completely off my rocker? Also, are there any actual programming languages with these semantics? « Aaron Rotenberg « Talk « 10:11, 31 October 2010 (UTC)[reply]

I think you're mixing levels of function call. before you call a function (at least in a strictly typed language) you have to set up the receiving variable, which (if I'm understanding correctly) requires a separate 'unit type' function call. That separate function call can only return one value, and so in an 'information-theory' sense it returns no information; it just contextualizes the output of the real function. You can think of this the same way as in standard math. if you have a function like x/r^2 it makes no difference from the perspective of the function whether the unit type of x and r are 'kilograms and meters' or 'pounds and yards', and the unit types themselves don't really add any information that's of use to the function, they merely serve to contextualize the inputs and outputs for those that wish to use the function. The article's a little jargon-ish, but I don't think it's wrong. this is not really my specialty though. --Ludwigs2 18:03, 31 October 2010 (UTC)[reply]
All types are subtypes of the unit type in the sense that there's a natural surjection t → unit for any t. Of course this can be lifted to a natural surjection (u → t) → (u → unit). Possibly what's confusing you (it confuses me) is that there are at least two different kinds of subtyping in programming languages: t ≤ u can mean t ⊆ u or it can mean t ≅ u ⊗ v for some v. What they have in common is a natural mapping from t to u, but it's an injection in one case and a surjection in the other. One could try to argue that the base object type of object-oriented languages counts is really the unit type, but in most real languages instances of that type have individual identity, so it's not a very good correspondence. As for a value of type unit conveying no information, one can say that a value of type t conveys log2 |t| bits of information (at least if |t| is finite), and it's in that sense that a unit return tells you nothing. -- BenRG (talk) 21:19, 31 October 2010 (UTC)[reply]

VLC

[edit]
Resolved

I want to test VLCs stream playback feature, but I can't find any urls to test. Does anyone know of some streams (free news channels or whatever it doesn't matter) that are video and audio for me to test? Thanks. 82.44.55.25 (talk) 17:33, 31 October 2010 (UTC)[reply]

VLC will stream from YouTube. Just visit a normal YouTube playback page, copy the URL from the browser's location bar, and in VLC do media->openNetworkStream, and paste that URL in there. -- Finlay McWalterTalk 17:45, 31 October 2010 (UTC)[reply]
You can play back KQED-FM's audio stream by opening http://www.kqed.org/radio/listen/kqedradio.m3u in VLC. -- Finlay McWalterTalk 17:47, 31 October 2010 (UTC)[reply]
Thanks! 82.44.55.25 (talk) 17:52, 31 October 2010 (UTC)[reply]

Orange pop-up rectangles

[edit]

What exactly is responsible for the orange pop-up rectangles when you move your cursor over things on the TV schedule page of www.radiotimes.com ? Java, Silverlight, what please? Thanks 92.24.186.230 (talk) 22:22, 31 October 2010 (UTC)[reply]

It's JavaScript, similar to the overLIB library.  ZX81  talk 22:40, 31 October 2010 (UTC)[reply]
(edit conflict : Same answer) - include a bit of the code
An example code piece is:
<a onmouseover="return overlib('TALK SHOW <br /><b>Piers Morgan\'s Life Stories: Rod Stewart</b> <br /><b>ITV1 London</b> <br /> (12:15am - 1:05am)', FGCOLOR, '#ff9922');" onmouseout="return nd();" class="url">Piers Morgan's<br>Life Stories: Ro...</a>
One of the key bits is the "onmouseover" event which is javascript - when the mouse goes over the thing it does a javascript function called "return overlib" which is described here http://www.bosrup.com/web/overlib/?Documentation

87.102.115.141 (talk) 22:43, 31 October 2010 (UTC)[reply]

Using the NoScript extension in Firefox

[edit]

How do I adjust the options of the NoScript extension in Firefox so that it prevents things which may be intrusive, malicious, or anti-privacy; but which still allows most webpages pages to be run in a normal way? Thanks Edit: re-wording that, how can I adjust NoScript so that most webpages run normally, but inessential potentially unsafe things don't? 92.24.186.230 (talk) 22:28, 31 October 2010 (UTC)[reply]

It is not possible to know what pages have malicious scripts. So, NoScript is designed to make it easy to allow scripts on pages you trust (even if your trust is misplaced). When you visit a site that has blocked scripts, NoScript will show you an alert. Click on the alert and you can select "Allow from xxxxxxx" where xxxxxx is one of the sites supplying scripts for the page. From that point on, you won't have blocked scripts from that source. -- kainaw 16:56, 1 November 2010 (UTC)[reply]
It is not possible to know whether a script is malicious because the definition of "malware" is a matter of opinion. For example, I consider Google Analytics "malicious," (it steals my CPU resources to track my behaviors and report my usage statistics to an uninvolved third-party), so I disallow it from running client-side processing. Most people do not share my viewpoints. Malware is entirely subject to individual perceptions - what software do you want to permit to run on your computer? Some people choose to upload personally identifiable information to unknown third parties over unencrypted channels. Some people intentionally send their financial account information to strangers. For these people, automating the procedure with a script is not "malicious." NoScript does not attempt to differentiate amongst scripts based on "malicious intent." Instead, it blocks all scripts by default, and allows the individual to make exceptions. Nimur (talk) 20:43, 1 November 2010 (UTC)[reply]
It's also subjective what constitutes an advertisement, but products like AdBlock exist anyway. I see no reason why a community-maintained Javascript block list for NoScript couldn't exist, but as far as I know it doesn't.
NoScript can be configured to allow scripts by default instead of forbidding them by default. In that mode it still protects against cross-site scripting and clickjacking better than Firefox alone, or at least so it claims. But this would allow a lot of privacy-compromising scripts to run, so it probably isn't what you want. -- BenRG (talk) 21:22, 1 November 2010 (UTC)[reply]

Privacy browser

[edit]

What browser (using Windows) preserves your privacy most, but which still allows normal internet surfing? Thanks 92.24.186.230 (talk) 22:31, 31 October 2010 (UTC)[reply]

Firefox, with flashblock and cookieculler extensions, and saved form data and saved passwords disabled in prefs. I forget if HTML5 offline data is in play yet. ¦ Reisio (talk) 00:05, 1 November 2010 (UTC)[reply]