"While" is a word in the English language that functions both as a noun and as a subordinating conjunction. Its meaning varies largely based on its intended function, position in the phrase and even the writer or speaker's regional dialect. As a conjunction, it is synonymous with the word "whilst", a form often considered archaic in American English, as well as in some style guides on both sides of the Atlantic.
A while and awhile are often confused due to the fact that while is often accompanied by the indefinite article. The main difference is that a while means "an amount of time" or "some duration" whereas awhile is an adverb meaning "for some amount of time" or "for some duration".
Both of these sentences yield the same effective meaning. Whilst is only a conjunction, and so its use here would be incorrect.
The primary function of the word as a conjunction is to indicate that two separate clauses occur at the same time.
While can also be legitimately used in the contrastive sense, comparable to the words "although" or "whereas", provided that it is not ambiguous (although some commentators, such as Eric Partridge, have disapproved of such use):
The latter sentence can mean either "during the time that Sally plays, Sue works" or "although Sally plays, Sue works" and is thus ambiguous.
Fowler's Modern English Usage disapproves of several uses of the conjunctive while. At times it is inappropriately used as a coordinating conjunction: "and" or "but" should be used instead. Its usage as "elegant variation" is also discouraged, as it is masquerading as a "formal word".
In some dialects of Northern England, while is translated into standard English as "until"; for example, "At least wait while we're done."
In standard British English and Australian English, whilst, as a conjunction, is synonymous with although, whereas, but or while. Unlike whilst, while is also used as a noun (as in "rest for a while") or a verb (as in "while away the hours").
The usage of whilst is chiefly British. For example, the BBC World Service website "Learning English", in their "Ask about English" section, uses the word whilst when explaining the usage of "while and whereas".
Some publications on both sides of the Atlantic disapprove of whilst in their style guides (along with "amidst" and "amongst"); for example: