BANGALORE — During the day, Vir Bahadur, 30, guards the entry gate of a small residential building in downtown Bangalore, from 8 in the morning until 6 in the evening, seven days a week.

Seated at a small table near the entrance, he screens visitors, thwarts salespeople, collects residents’ couriers and, on occasion, carries shopping bags and changes light bulbs. After he leaves work, he goes straight to his second job at another apartment block nearby. There, he is the nighttime security guard until 8 the next morning.

Life and Love in the New Bangalore Tales of ambition and youth from India’s outsourcing hub.

His nonstop work cycle earns him about $200 a month, most of which he sends home to his family in Nepal. Mr. Bahadur left his village in the Bajhang district in northern Nepal six years ago and traversed thousands of miles to Bangalore in search of work.

Unskilled immigrants like Mr. Bahadur, from India’s distant corners and beyond, are everywhere in the city: visible sentinels at the gates of its shopping malls, banks, residential high-rises, hotels, office parks and hospitals. The city police, on the other hand, are a far less noticeable presence, the traffic police on the streets being the exception.

“There are over 300,000 security guards in Bangalore, several times the number of policemen,” said Mohandas Pai, a former chief financial officer of Infosys, one of India’s largest technology services firms, which is based in Bangalore.

“Nowhere in the world is the ratio of private security to state security so skewed,” observed Mr. Pai, now the vice president of Bangalore Political Action Committee, a nonprofit forum that works to improve the city.

Bangalore currently has a police force of 16,000 and in the last five years, 3,000 vacancies because of a hiring freeze, said Raghavendra Auradkar, Bangalore’s police commissioner. As Bangalore’s population has grown, the police force has shrunk.

It is a scant force for a city of 10 million. New York, with a population of 8.3 million, has a uniform strength of 34,500.

On the other hand, Bangalore, known as the outsourcing capital not just in technology circles, is teeming with private security armies. Workers in all hue of uniform are a ubiquitous fixture at the gates and doors of businesses and homes. In many places, security guards direct cars in and out. They keep tabs on staff, visitors and maintenance people entering and leaving, open gates and note the license plate numbers of visitors’ cars.

Hundreds of guards watch over the establishments of the world’s biggest multinational companies like IBM, Yahoo, Google and Cisco in Bangalore. Security outside these companies became more intensive after the November 2008 terrorist attacks in Mumbai.

The guards who work for the security contractors supplying large businesses get eight-hour work shifts, decent pay and allowances. But others like Mr. Bahadur, who work for middlemen who call themselves agencies, are on vigil around the clock without a day off.

Like many of them, Mr. Bahadur eats, sleeps and lives at work. He has no home in Bangalore and barely any belongings, except for a few sets of clothes, which he leaves at his workplaces. Many guards from his native region in Nepal are in the city, but he has no days off to socialize with them.

His break comes once a year. Then, for about two months he returns to his village, his wife and his three school-age children.

Some see security guards like Mr. Bahadur as a necessary accoutrement, even a deterrent to crime. They keep vigil on the street outside and at times assist criminal investigations.

“They may not be trained but have provided valuable clues in some cases,” said Pronab Mohanty, Bangalore’s additional commissioner of police in the crime division.

At the 100-flat apartment complex where Mr. Pai lives, two security persons guard each of the three gates. They mostly serve to keep out street salesmen, Mr. Pai said, “but a smart salesman always finds a way to get through.”

Others, however, view them as a symbolic token of power. To them, uniformed security guards denote money, exclusivity and privilege, giving the walled, gated communities and office parks the feel of little republics, cities within a city.

Deploying a private, though benign, army to keep people out of apartment complexes and gated communities reeks of social arrogance, said Chandan Gowda, a professor of sociology at Azim Premji University.

“It is as if they are guarding a few islands of security amidst deteriorating urban spaces around them,” he said.

But as the demand for security guards steadily rises, it has spawned a haphazardly run cottage industry that recruits the elderly, who can be hired for less money, or that brings in labor from distant states. The imports are untrained and ill at ease and cannot speak the local language, Kannada.

The proliferation of security guards is yet another sign of the privatization of governance in India, said Mr. Pai, which added to the cost of doing business.

One November morning, a bank employee was brutally attacked at an A.T.M. on a busy road as she was making a withdrawal. The attacker has not been caught so far. But the government has responded not with increased patrolling but with threats to close bank A.T.M.s that do not have round-the-clock security.

If the government follows through on its threat, Bangalore is sure to see more of the likes of Mr. Bahadur, although maybe not with the same smile, which he wears throughout the day, and sunny disposition that allows him to accept his circumstances with equanimity.

“It is a nice job,” he said.

Saritha Rai sometimes feels she is the only person living in Bangalore who was actually raised here. There’s never a dull moment in her mercurial metropolis. Reach her on Twitter@SarithaRai.