Ghilman (singular ghulam) applies to young male servants in two contexts
In Islamic paradise
The ghilman, or "wuldan" according to the Qur'an (52:24, 56:17. 76:19), are divine youths, forever young, beautiful as pearls, who work in heaven, alongside their female counterparts called the houris, in the service of the righteous Muslims. The promise of this reward is repeated four different times in the Qur'an.
Philip K. Hitti claims in The Arabs (1943) that
We read of ghilman in the reign of al-Rashid; but it was evidently the caliph Al-Amin who, following Persian precedent, established in the Arabic world the ghilman institution for the practice of unnatural sexual relations. The possible homoerotic implications of the Qur'anic mentions of handsome cupbearers were known in the wider society from an early date and the Hanafi jurists discussed - and eventually rejected - the notion that the sodomy of boys was a pleasure reserved for the afterlife. 
In Sassanian Persia, ghilman worked as slaves employed by Kings and generals.
Since the break-up of the Abbasid Caliphate, the ghilman were grouped into whole armies. They were usually Turkic in origin and fought as cavalrymen. Thus, in the Ottoman Empire, the term also referred to slave-soldiers, as well as to young boy recruits in devs,irme.
The ghilman seem to have lived celibate lives. The absence of family life and offspring was one of the reasons why ghilman, even when attaining power, generally failed to start dynasties or proclaim their independence. The only exception to this was the Ghaznavid dynasty of Afghanistan, which originated amongst the ghilman of the Samanid dynasty.
Chroniclers also give accounts of the political connotations of their relationships; the ghulam Fatik, for example, briefly governed Aleppo for the Fa-timids before being murdered in his sleep by his ghulam lover. Also, the Buwayhid prince Bakhtiyar's infatuation with a ghulam is given as one of the reasons as why he lost his throne and his life.